Giunsa ang Pag-install ug Pag-configure sa PowerDNS (uban ang MariaDB) ug PowerAdmin sa RHEL/CentOS 7


Ang PowerDNS kay DNS server nga nagdagan sa daghang Linux/Unix derivatives. Mahimo kini nga ma-configure sa lainlaing mga backend lakip ang mga file sa estilo sa BIND zone, relational database o load balancing/failover algorithm. Mahimo usab kini nga i-setup ingon usa ka DNS recursor nga nagdagan ingon usa ka bulag nga proseso sa server.

Ang pinakabag-o nga bersyon sa PowerDNS Authoritative server mao ang 3.4.4, apan ang anaa sa EPEL repository karon mao ang 3.4.3. Akong irekomendar ang pag-instalar sa usa alang sa EPEL repository tungod sa kamatuoran nga kini nga bersyon gisulayan sa CentOS ug Fedora. Nianang paagiha mahimo usab nimo nga dali nga ma-update ang PowerDNS sa umaabot.

Ang kini nga artikulo nagtinguha nga ipakita kanimo kung giunsa ang pag-install ug pag-setup sa master PowerDNS server nga adunay backend sa MariaDB ug ang PowerAdmin - usa ka mahigalaon nga web interface sa pagdumala nga himan alang sa PowerDNS.

Alang sa katuyoan niini nga artikulo akong gamiton ang server nga adunay:

Hostname: centos7.localhost 
IP Address 192.168.0.102

Lakang 1: Pag-instalar sa PowerDNS gamit ang MariaDB Backend

1. Una kinahanglan nimo nga i-enable ang EPEL repository para sa imong server gamita lang ang:

# yum install epel-release.noarch 

2. Ang sunod nga lakang mao ang pag-instalar sa MariaDB server. Kini dali nga mahimo pinaagi sa pagpadagan sa mosunod nga sugo:

# yum -y install mariadb-server mariadb

3. Sunod atong i-configure ang MySQL aron mahimo ug magsugod sa pag-boot sa system:

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

4. Karon nga ang serbisyo sa MySQL nagdagan, kami magsiguro ug mag-setup og password alang sa MariaDB pinaagi sa pagpadagan:

# 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. Sa higayon nga malamposon ang pag-configure sa MariaDB, makapadayon pa kita sa pag-instalar sa PowerDNS. Kini dali nga makompleto pinaagi sa pagdagan:

# yum -y install pdns pdns-backend-mysql

6. Ang configuration file para sa PowerDNS nahimutang sa /etc/pdns/pdns, pero sa dili pa kini i-edit, mag-setup mi og MySQL database para sa serbisyo sa PowerDNS. Una magkonektar kami sa MySQL server ug maghimo usa ka database nga adunay ngalan nga powerdns:

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

7. Sunod, maghimo mi ug database user nga gitawag ug 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;

Pahinumdom: Ilisan ang \tecmint123 sa aktuwal nga password nga gusto nimong gamiton para sa imong setup.

8. Nagpadayon kami pinaagi sa paghimo sa mga lamesa sa database nga gigamit sa PowerDNS. Ipatuman ang mga bloke matag bloke:

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

Mahimo ka na nga mogawas sa MySQL console pinaagi sa pag-type:

MariaDB [(none)]> quit;

9. Sa katapusan makapadayon kita sa pag-configure sa atong PowerDNS sa paagi nga, gamiton niini ang MySQL isip backend. Alang niana nga katuyoan ablihi ang PowerDNS configuration file nga nahimutang sa:

# vim /etc/pdns/pdns.conf 

Sa kana nga file pangitaa ang mga linya nga ingon niini:

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

Pagkahuman lang ibutang ang mosunod nga code:

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

Usba ang \user-pass gamit ang aktuwal nga password nga imong gitakda sa sayo pa. Mao kini ang hitsura sa akong configuration:

I-save ang imong pagbag-o ug paggawas gikan sa.

10. Karon magsugod kami ug idugang ang PowerDNS sa listahan sa mga serbisyo sugod sa system boot:

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

Niini nga punto ang imong PowerDNS server kay nagdagan na. Para sa dugang nga impormasyon bahin sa PowerDNS mahimo nimong tan-awon ang manwal nga anaa sa http://downloads.powerdns.com/documentation/html/index.html