Bii o ṣe le Fi sii ati Tunto PowerDNS (pẹlu MariaDB) ati PowerAdmin ni RHEL/CentOS 7


PowerDNS jẹ olupin DNS ti n ṣiṣẹ lori ọpọlọpọ awọn itọsẹ Linux/Unix. O le ṣe tunto pẹlu awọn ẹhin ẹhin oriṣiriṣi pẹlu awọn faili agbegbe ara BIND, awọn apoti isura data ibatan tabi iwọntunwọnsi fifuye/ailagbara. O tun le jẹ iṣeto bi olupilẹṣẹ DNS ti n ṣiṣẹ bi ilana lọtọ lori olupin naa.

Ẹya tuntun ti olupin aṣẹ PowerDNS jẹ 3.4.4, ṣugbọn eyi ti o wa ni ibi ipamọ EPEL ni bayi jẹ 3.4.3. Emi yoo ṣeduro fifi sori ọkan fun ibi ipamọ EPEL nitori otitọ pe ẹya yii ti ni idanwo ni CentOS ati Fedora. Iyẹn ọna iwọ yoo tun ni anfani lati ṣe imudojuiwọn PowerDNS ni irọrun ni ọjọ iwaju.

Nkan yii ni ero lati fihan ọ bi o ṣe le fi sori ẹrọ ati ṣeto olupin PowerDNS oluwa pẹlu ẹhin MariaDB ati PowerAdmin - irinṣẹ iṣakoso oju opo wẹẹbu ọrẹ kan fun PowerDNS.

Fun idi ti nkan yii Emi yoo lo olupin pẹlu:

Hostname: centos7.localhost 
IP Address 192.168.0.102

Igbesẹ 1: Fifi PowerDNS pẹlu MariaDB Backend

1. Ni akọkọ o nilo lati mu ibi ipamọ EPEL ṣiṣẹ fun olupin rẹ lo ni lilo:

# yum install epel-release.noarch 

2. Igbese ti n tẹle ni lati fi sori ẹrọ olupin MariaDB naa. Eyi le ṣee ṣe ni rọọrun nipa ṣiṣe pipaṣẹ wọnyi:

# yum -y install mariadb-server mariadb

3. Nigbamii ti a yoo tunto MySQL lati jẹki ati bẹrẹ lori eto bata:

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

4. Bayi pe iṣẹ MySQL n ṣiṣẹ, a yoo ni aabo ati ṣeto ọrọ igbaniwọle kan fun MariaDB nipa ṣiṣe:

# 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. Lọgan ti iṣeto MariaDB ṣe ni aṣeyọri, a le tẹsiwaju siwaju pẹlu fifi sori PowerDNS. Eyi ni a pari ni rọọrun nipasẹ ṣiṣiṣẹ:

# yum -y install pdns pdns-backend-mysql

6. Faili iṣeto fun PowerDNS wa ni /etc/pdns/pdns , ṣugbọn ṣaaju ṣiṣatunkọ rẹ, a yoo ṣeto ipilẹ data MySQL kan fun iṣẹ PowerDNS. Ni akọkọ a yoo sopọ si olupin MySQL ati pe yoo ṣẹda ipilẹ data pẹlu awọn orukọ agbara:

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

7. Itele, a yoo ṣẹda olumulo ipamọ data ti a pe ni 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;

Akiyesi: Rọpo\"tecmint123" pẹlu ọrọ igbaniwọle gangan ti o fẹ lo fun iṣeto rẹ.

8. A tẹsiwaju nipa ṣiṣẹda awọn tabili ibi ipamọ data ti PowerDNS lo. Ṣe bulọọki wọnyẹn nipasẹ bulọọki:

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

O le jade kuro ni itọnisọna MySQL nipa titẹ:

MariaDB [(none)]> quit;

9. Lakotan a le tẹsiwaju pẹlu tito leto PowerDNS wa ni ọna ti, yoo lo MySQL bi ẹhin. Fun idi naa ṣii faili iṣeto PowerDNS ti o wa ni:

# vim /etc/pdns/pdns.conf 

Ninu faili naa wa fun awọn ila ti o nwa bi eleyi:

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

Ni kete lẹhin ti o fi koodu atẹle sii:

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

Yipada\"olumulo-kọja" pẹlu ọrọigbaniwọle gangan ti o ṣeto tẹlẹ. Eyi ni bi iṣeto mi ṣe dabi:

Fipamọ iyipada rẹ ki o jade kuro.

10. Bayi a yoo bẹrẹ ati fi PowerDNS kun si atokọ ti awọn iṣẹ ti o bẹrẹ ni bata eto:

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

Ni aaye yii olupin olupin PowerDNS rẹ ti n ṣiṣẹ. Fun alaye diẹ sii nipa PowerDNS o le tọka si itọnisọna ti o wa ni http://downloads.powerdns.com/documentation/html/index.html