Kif tinstalla u tikkonfigura PowerDNS (ma' MariaDB) u PowerAdmin f'RHEL/CentOS 7


PowerDNS huwa server DNS li jaħdem fuq ħafna derivattivi Linux/Unix. Jista 'jiġi kkonfigurat b'backends differenti inklużi fajls taż-żona tal-istil BIND, databases relazzjonali jew algoritmi tal-ibbilanċjar tat-tagħbija/failover. Jista 'wkoll jiġi stabbilit bħala recursor DNS li jaħdem bħala proċess separat fuq is-server.

L-aħħar verżjoni tas-server PowerDNS Authoritative hija 3.4.4, iżda dik disponibbli fir-repożitorju EPEL bħalissa hija 3.4.3. Nirrakkomanda li tinstalla dik għar-repożitorju EPEL minħabba l-fatt li din il-verżjoni hija ttestjata f'CentOS u Fedora. B'dan il-mod inti tkun tista' wkoll taġġorna faċilment PowerDNS fil-futur.

Dan l-artikolu għandu l-ħsieb jurik kif tinstalla u twaqqaf server PowerDNS ewlieni b'backend MariaDB u l-PowerAdmin - għodda ta 'ġestjoni ta' interface web faċli għal PowerDNS.

Għall-iskop ta' dan l-artikolu se nkun qed nuża server ma':

Hostname: centos7.localhost 
IP Address 192.168.0.102

Pass 1: Installazzjoni ta 'PowerDNS ma' MariaDB Backend

1. L-ewwel trid tippermetti r-repożitorju EPEL għas-server tiegħek sempliċement uża:

# yum install epel-release.noarch 

2. Il-pass li jmiss huwa li tinstalla s-server MariaDB. Dan jista 'jsir faċilment billi tħaddem il-kmand li ġej:

# yum -y install mariadb-server mariadb

3. Sussegwentement se nikkonfiguraw MySQL biex nippermettu u nibdew mal-boot tas-sistema:

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

4. Issa li s-servizz MySQL qed jaħdem, aħna niżguraw u nistabbilixxu password għal MariaDB billi nħaddmu:

# 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. Ladarba l-konfigurazzjoni ta 'MariaDB issir b'suċċess, nistgħu nipproċedu aktar bl-installazzjoni ta' PowerDNS. Dan jitlesta faċilment billi taħdem:

# yum -y install pdns pdns-backend-mysql

6. Il-fajl tal-konfigurazzjoni għall-PowerDNS jinsab f'/etc/pdns/pdns, iżda qabel ma neditjawh, aħna nistabbilixxu database MySQL għas-servizz PowerDNS. L-ewwel se nikkonnettjaw mas-server MySQL u noħolqu database bl-isem powerdns:

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

7. Sussegwentement, se noħolqu utent tad-database imsejjaħ powerdns:

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;

Nota: Ibdel \tecmint123 bil-password attwali li trid tuża għas-setup tiegħek.

8. Nipproċedu billi noħolqu t-tabelli tad-database użati minn PowerDNS. Eżegwixxi dawk blokk b'blokk:

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
);

Issa tista' toħroġ mill-console MySQL billi ttajpja:

MariaDB [(none)]> quit;

9. Fl-aħħarnett nistgħu nipproċedu bil-konfigurazzjoni tal-PowerDNS tagħna b'mod li, se juża MySQL bħala backend. Għal dak il-għan iftaħ il-fajl tal-konfigurazzjoni PowerDNS li jinsab fi:

# vim /etc/pdns/pdns.conf 

F'dak il-fajl fittex il-linji li jidhru bħal dan:

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

Eżatt wara poġġi l-kodiċi li ġej:

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

Ibdel \user-pass bil-password attwali li ssettjajt qabel. Hawn hu kif tidher il-konfigurazzjoni tiegħi:

Issejvja l-bidla tiegħek u oħroġ minn.

10. Issa se nibdew u nżidu PowerDNS mal-lista tas-servizzi li jibdew fil-boot tas-sistema:

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

F'dan il-punt is-server PowerDNS tiegħek qiegħed jaħdem. Għal aktar informazzjoni dwar PowerDNS tista' tirreferi għall-manwal disponibbli fuq http://downloads.powerdns.com/documentation/html/index.html