Install and configure PowerDNS and PowerAdmin in RHEL/CentOS 7

Source: Internet
Author: User

Install and configure PowerDNS and PowerAdmin in RHEL/CentOS 7

PowerDNS is a DNS server running on many Linux/Unix derivative versions. It can be configured using different backend systems, including BIND regional files and relational databases, or Load Balancing/failover algorithms. It can also be configured as a DNS recursion to run as an independent process on the server.

The latest version of the PowerDNS authorization server is 3.4.4, but the current version available in the EPEL repository is 3.4.3. I recommend that you install the one provided in the EPEL repository because this version has been tested in CentOS and Fedora. In this way, you can easily update PowerDNS in the future.

This article demonstrates how to install and configure MariaDB as the backend PowerDNS in RHEL/CentOS 7 and its user-friendly Web management tool PowerAdmin.

PowerDNS + Poweradmin under CentOS

For the purpose of writing this article, I will use the following servers:

  1. Host Name: centos7.localhost
  2. IP Address: 192.168.0.102
Part 1: Install PowerDNS with MariaDB backend

1. First, you need to enable the EPEL repository for your system, just use:

  1. # yum install epel-release.noarch

Enable Epel Repository

2. The next step is to install the MariaDB server. Run the following command:

  1. # yum -y install mariadb-server mariadb

Install MariaDB Server

3. Next, we will configure and enable MariaDB and set the boot start:

  1. # systemctl enable mariadb.service
  2. # systemctl start mariadb.service

Enable MariaDB boot

4. Now that the MariaDB service is running, we will set a password for MariaDB for security reinforcement and run the following command:

  1. # mysql_secure_installation

Do as instructed

  1. /bin/mysql_secure_installation: line 379: find_mysql_client: command not found
  2. NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
  3. SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
  4. In order to log intoMariaDB to secure it, we'll need the current
  5. password for the root user. If you've just installed MariaDB,and
  6. you haven't set the root password yet, the password will be blank,
  7. so you should just press enter here.
  8. Enter current password for root (enter for none): Press ENTER
  9. OK, successfully used password, moving on...
  10. Setting the root password ensures that nobody can log into the MariaDB
  11. root user without the proper authorisation.
  12. Set root password? [Y/n] y
  13. New password: ← Set New Password
  14. Re-enter new password: ← Repeat Above Password
  15. Password updated successfully!
  16. Reloading privilege tables..
  17. ... Success!
  18. By default, a MariaDB installation has an anonymous user, allowing anyone
  19. to log into MariaDB without having to have a user account created for
  20. them. This is intended only for testing, and to make the installation
  21. go a bit smoother. You should remove them before moving into a
  22. production environment.
  23. Remove anonymous users? [Y/n] y ← Choose “y” to disable that user
  24. ... Success!
  25. Normally, root should only be allowed to connect from 'localhost'. This
  26. ensures that someone cannot guess at the root password from the network.
  27. Disallow root login remotely? [Y/n] n ← Choose “n” for no
  28. ... skipping.
  29. By default, MariaDB comes with a database named 'test' that anyone can
  30. access. This is also intended only for testing, and should be removed
  31. before moving into a production environment.
  32. Remove test database and access to it? [Y/n] y ← Choose “y” for yes
  33. - Dropping test database...
  34. ... Success!
  35. - Removing privileges on test database...
  36. ... Success!
  37. Reloading the privilege tables will ensure that all changes made so far
  38. will take effect immediately.
  39. Reload privilege tables now? [Y/n] y ← Choose “y” for yes
  40. ... Success!
  41. Cleaning up...
  42. All done! If you've completed all of the above steps, your MariaDB
  43. installation should now be secure.
  44. ThanksforusingMariaDB!

5. After MariaDB is configured successfully, we can continue to install PowerDNS. Run the following command:

  1. # yum -y install pdns pdns-backend-mysql

Install PowerDNS with MariaDB backend

6. The configuration file of PowerDNS is located/etc/pdns/pdnsBefore editing, We will configure a MariaDB database for the PowerDNS service. First, we connect to the MariaDB server and create a database named powerdns:

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

Create a PowerDNS Database

7. Next, we will create a database user named powerdns:

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

Create a PowerDNS user

Note: Replace "tecmint123" with the actual password you want to set.

8. We will continue to create the database tables to be used by PowerDNS. Perform the following operations like stacked wood:

  1. MariaDB[(none)]> USE powerdns;
  2. MariaDB[(none)]> CREATE TABLE domains (
  3. id INT auto_increment,
  4. name VARCHAR(255) NOT NULL,
  5. master VARCHAR(128) DEFAULT NULL,
  6. last_check INT DEFAULT NULL,
  7. type VARCHAR(6) NOT NULL,
  8. notified_serial INT DEFAULT NULL,
  9. account VARCHAR(40) DEFAULT NULL,
  10. primary key (id)
  11. );

Create a table named domains for PowerDNS

  1. MariaDB[(none)]> CREATE UNIQUE INDEX name_index ON domains(name);
  2. MariaDB[(none)]> CREATE TABLE records (
  3. id INT auto_increment,
  4. domain_id INT DEFAULT NULL,
  5. name VARCHAR(255) DEFAULT NULL,
  6. type VARCHAR(6) DEFAULT NULL,
  7. content VARCHAR(255) DEFAULT NULL,
  8. ttl INT DEFAULT NULL,
  9. prio INT DEFAULT NULL,
  10. change_date INT DEFAULT NULL,
  11. primary key(id)
  12. );

Create a table records for PowerDNS

  1. MariaDB[(none)]> CREATE INDEX rec_name_index ON records(name);
  2. MariaDB[(none)]> CREATE INDEX nametype_index ON records(name,type);
  3. MariaDB[(none)]> CREATE INDEX domain_id ON records(domain_id);

Create a table Index

  1. MariaDB[(none)]> CREATE TABLE supermasters (
  2. ip VARCHAR(25) NOT NULL,
  3. nameserver VARCHAR(255) NOT NULL,
  4. account VARCHAR(40) DEFAULT NULL
  5. );

Create a table supermasters

You can run the following command to exit the MariaDB console:

  1. MariaDB[(none)]> quit;

9. Finally, we can continue to configure PowerDNS with MariaDB as the background. Open the PowerDNS configuration file:

  1. # vim /etc/pdns/pdns.conf

Search for rows like the following in the file:

  1. #################################
  2. # launch Which backends to launch and order to query them in
  3. #
  4. # launch=

Put the following code after this:

  1. launch=gmysql
  2. gmysql-host=localhost
  3. gmysql-user=powerdns
  4. gmysql-password=user-pass
  5. gmysql-dbname=powerdns

Change "user-pass" to the actual password you set earlier. The configuration is as follows:

Configure PowerDNS

Save the changes and exit.

10. Now, we will start and add PowerDNS to the system startup list:

  1. # systemctl enable pdns.service
  2. # systemctl start pdns.service

Enable and start PowerDNS

In this step, your PowerDNS server is up and running. To obtain

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.