Wéi installéiere a konfiguréieren PowerDNS (mat MariaDB) a PowerAdmin an RHEL/CentOS 7


PowerDNS ass en DNS Server deen op ville Linux/Unix Derivate leeft. Et kann mat verschiddene Backends konfiguréiert ginn, dorënner BIND-Stil Zonedateien, relational Datenbanken oder Belaaschtungs-/Failover-Algorithmen. Et kann och als DNS-Recursor opgestallt ginn, deen als separat Prozess um Server leeft.

Déi lescht Versioun vum PowerDNS Autoritative Server ass 3.4.4, awer déi verfügbar am EPEL Repository elo ass 3.4.3. Ech géif recommandéieren deen fir den EPEL Repository z'installéieren wéinst der Tatsaach datt dës Versioun an CentOS a Fedora getest gëtt. Sou kënnt Dir och an Zukunft PowerDNS einfach aktualiséieren.

Dësen Artikel ass wëlles Iech ze weisen wéi Dir de Master PowerDNS Server mat engem MariaDB Backend an dem PowerAdmin installéiere kënnt an opstellt - e frëndlecht Webinterface-Management-Tool fir PowerDNS.

Fir den Zweck vun dësem Artikel wäert ech Server mat:

Hostname: centos7.localhost 
IP Address 192.168.0.102

Schrëtt 1: Installéiere PowerDNS mat MariaDB Backend

1. Als éischt musst Dir den EPEL Repository fir Äre Server aktivéieren einfach benotzen:

# yum install epel-release.noarch 

2. De nächste Schrëtt ass de MariaDB Server z'installéieren. Dëst kann einfach gemaach ginn andeems Dir de folgende Kommando ausféiert:

# yum -y install mariadb-server mariadb

3. Als nächst wäerte mir MySQL konfiguréieren fir ze aktivéieren a beim Systemboot starten:

# systemctl enable mariadb.service
# systemctl start mariadb.service

4. Elo datt de MySQL Service leeft, wäerte mir e Passwuert fir MariaDB sécheren an astellen andeems Dir laaft:

# mysql_secure_installation
/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):  Press ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y     
New password:  ← Set New Password
Re-enter new password:  ← Repeat Above Password
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y ← Choose “y” to disable that user
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n ← Choose “n” for no
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y ← Choose “y” for yes
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y ← Choose “y” for yes
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

5. Wann d'MariaDB Konfiguratioun erfollegräich gemaach ass, kënne mir weider mat der Installatioun vu PowerDNS weidergoen. Dëst ass einfach ofgeschloss andeems Dir laaft:

# yum -y install pdns pdns-backend-mysql

6. D'Konfiguratiounsdatei fir PowerDNS läit an /etc/pdns/pdns, awer ier Dir se ännert, setze mir eng MySQL-Datebank fir PowerDNS-Service op. Als éischt wäerte mir mam MySQL-Server verbannen an eng Datebank mam Numm powerdns erstellen:

# mysql -u root -p
MariaDB [(none)]> CREATE DATABASE powerdns;

7. Als nächst wäerte mir e Datebank Benotzer genannt powerdns erstellen:

MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'centos7.localdomain' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> FLUSH PRIVILEGES;

Bemierkung: Ersetzt \tecmint123 mam aktuellen Passwuert dat Dir fir Äre Setup benotze wëllt.

8. Mir fuere weider andeems Dir d'Datebanktabellen vun PowerDNS benotzt. Fëllt dës Block fir Block aus:

MariaDB [(none)]> USE powerdns;
MariaDB [(none)]> CREATE TABLE domains (
id INT auto_increment,
name VARCHAR(255) NOT NULL,
master VARCHAR(128) DEFAULT NULL,
last_check INT DEFAULT NULL,
type VARCHAR(6) NOT NULL,
notified_serial INT DEFAULT NULL,
account VARCHAR(40) DEFAULT NULL,
primary key (id)
);
MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name);
MariaDB [(none)]> CREATE TABLE records (
id INT auto_increment,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(6) DEFAULT NULL,
content VARCHAR(255) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
primary key(id)
);
MariaDB [(none)]> CREATE INDEX rec_name_index ON records(name);
MariaDB [(none)]> CREATE INDEX nametype_index ON records(name,type);
MariaDB [(none)]> CREATE INDEX domain_id ON records(domain_id);
MariaDB [(none)]> CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);

Dir kënnt elo d'MySQL Konsole verloossen andeems Dir tippt:

MariaDB [(none)]> quit;

9. Endlech kënne mir weidergoen mat der Konfiguratioun vun eisem PowerDNS op eng Manéier datt et MySQL als Backend benotzt. Fir dësen Zweck öffnen d'PowerDNS Konfiguratiounsdatei op:

# vim /etc/pdns/pdns.conf 

An deem Fichier sicht d'Linnen esou ausgesinn:

#################################
# launch        Which backends to launch and order to query them in
#
# launch=

Just duerno setzt de folgende Code:

launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=user-pass
gmysql-dbname=powerdns

Ännert de \Benotzerpass mam aktuellen Passwuert, deen Dir virdru festgestallt hutt. Hei ass wéi meng Konfiguratioun ausgesäit:

Späichert Är Ännerung a gitt aus.

10. Elo wäerte mir ufänken a PowerDNS op d'Lëscht vun de Servicer, déi beim Systemboot starten:

# systemctl enable pdns.service 
# systemctl start pdns.service 

Zu dësem Zäitpunkt ass Äre PowerDNS Server op a leeft. Fir méi Informatiounen iwwer PowerDNS kënnt Dir op d'Handbuch referenzéieren déi verfügbar ass op http://downloads.powerdns.com/documentation/html/index.html