Yadda ake Shigar da Sanya PowerDNS (tare da MariaDB) da PowerAdmin a cikin RHEL/CentOS 7


PowerDNS uwar garken DNS ce da ke aiki akan abubuwan Linux/Unix da yawa. Ana iya saita shi tare da maɓalli daban-daban ciki har da fayilolin yankin salon BIND, bayanan alaƙa ko daidaitawa/gazawar algorithms. Hakanan za'a iya saita shi azaman mai maimaita DNS yana gudana azaman tsari daban akan sabar.

Sabon sigar uwar garken Izini na PowerDNS shine 3.4.4, amma wanda ake samu a ma'ajiyar EPEL a yanzu shine 3.4.3. Zan ba da shawarar shigar da ɗayan don ma'ajiyar EPEL saboda gaskiyar cewa an gwada wannan sigar a cikin CentOS da Fedora. Ta haka za ku kuma sami damar sabunta PowerDNS cikin sauƙi nan gaba.

Wannan labarin yana nufin ya nuna muku yadda ake shigarwa da saitin uwar garken PowerDNS tare da bayan MariaDB da PowerAdmin - kayan aikin sarrafa yanar gizo na abokantaka don PowerDNS.

Don manufar wannan labarin zan yi amfani da uwar garken tare da:

Hostname: centos7.localhost 
IP Address 192.168.0.102

Mataki 1: Shigar da PowerDNS tare da MariaDB Backend

1. Da farko kuna buƙatar kunna ma'ajiyar EPEL don uwar garken ku kawai kuyi amfani da:

# yum install epel-release.noarch 

2. Mataki na gaba shine shigar da uwar garken MariaDB. Ana iya yin hakan cikin sauƙi ta hanyar gudanar da umarni mai zuwa:

# yum -y install mariadb-server mariadb

3. Na gaba za mu saita MySQL don kunnawa da farawa akan tsarin boot:

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

4. Yanzu da sabis na MySQL ke gudana, za mu tabbatar da saita kalmar sirri don MariaDB ta hanyar gudu:

# 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. Da zarar MariaDB sanyi ya yi nasara, za mu iya ci gaba da ci gaba tare da shigarwa na PowerDNS. Ana yin wannan cikin sauƙi ta hanyar gudu:

# yum -y install pdns pdns-backend-mysql

6. Fayil ɗin daidaitawa don PowerDNS yana cikin /etc/pdns/pdns, amma kafin gyara shi, za mu saita bayanan MySQL don sabis na PowerDNS. Da farko za mu haɗa zuwa uwar garken MySQL kuma za mu ƙirƙiri bayanan bayanai tare da suna powerdns:

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

7. Bayan haka, za mu ƙirƙiri mai amfani da bayanai mai suna 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;

Lura: Sauya \tecmint123 tare da ainihin kalmar sirri da kuke son amfani da ita don saitin ku.

8. Muna ci gaba ta hanyar ƙirƙirar tebur ɗin bayanan da PowerDNS ke amfani da shi. Kashe waɗannan toshe ta hanyar toshe:

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

Yanzu zaku iya fita daga MySQL console ta buga:

MariaDB [(none)]> quit;

9. A ƙarshe za mu iya ci gaba da daidaitawa PowerDNS ta hanyar da, zai yi amfani da MySQL a matsayin backend. Don wannan dalili, buɗe fayil ɗin sanyi na PowerDNS wanda yake a:

# vim /etc/pdns/pdns.conf 

A cikin fayil ɗin, duba layin da ke kama da haka:

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

Bayan haka sai a sanya code mai zuwa:

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

Canja \user-pass tare da ainihin kalmar sirrin da kuka saita a baya. Ga yadda tsarin nawa yayi kama da:

Ajiye canjin ku kuma fita daga.

10. Yanzu za mu fara da ƙara PowerDNS zuwa jerin ayyukan da suka fara a tsarin boot:

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

A wannan lokacin uwar garken PowerDNS naka yana aiki. Don ƙarin bayani game da PowerDNS zaka iya komawa zuwa littafin da ake samu a http://downloads.powerdns.com/documentation/html/index.html