How to Install Power DNS Red Hat 7

There are two Power DNS Red Hat nameserver products: the Authoritative Server and the Recursor. While most other nameservers fully combine these functions, Power DNS offers them separately, but can mix both authoritative and recursive usage seamlessly.

How to Install Power DNS as Authoritative

The Authoritative Server will answer questions about domains it knows about, but will not go out on the net to resolve queries about other domains. When the Authoritative Server answers a question, it comes out of the database, and can be trusted as being authoritative. There is no way to pollute the cache or to confuse the daemon.

Power DNS Red Hat Recursor

The Recursor, conversely, by default has no knowledge of domains itself, but will always consult other authoritative servers to answer questions given to it.

Power DNS has been designed to serve both the needs of small installations by being easy to setup, as well as for serving very large query volumes on large numbers of domains. Additionally, through use of clever programming techniques, Power DNS server offers very high domain resolution performance.

Another prime goal is security. By the use of language features, the PowerDNS source code is reasonably small which makes auditing easy. In the same way, library features have been used to mitigate the risks of buffer overflows.

Finally, Power DNS server is able to give a lot of statistics on its operation which is both helpful in determining the scalability of an installation as well as for spotting problems.

Update Red Hat 7 System

First let’s update the system.

yum update

Add EPEL Repo to Red Hat 7

Now let’s add the EPEL Repo into RedHat Yum Repos and update again.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install Power DNS from EPEL repository

After adding the EPEL repo we have access to Power DNS packages and install them with yum.

yum -y install pdns pdns-backend-mysql

Change Red Hat 7 Machine Hostname

hostnamectl set-hostname powerdns.local

Add Power DNS Repository

yum install epel-release yum-plugin-priorities
curl -o /etc/yum.repos.d/powerdns-rec-master.repo https://repo.powerdns.com/repo-files/centos-rec-master.repo
yum install pdns-recursor
Install Power DNS
Install Power DNS

Install MariaDB with Power DNS on Red Hat

yum -y install mariadb-server mariadb
install mariadb

Manage MariaDB service on Red Hat

Enable MariaDB service on boot:

systemctl enable mariadb.service

Start MariaDB service with SystemD:

systemctl start mariadb.service

Secure MySQL installation using mysql script, delete all unnecessary data, anonymous access and setup a root password.

mysql_secure_installation

Login into MySQL with the root user and password defined on previous step.

mysql -u root -p
mysql root user

Create a database with name ‘powerdns’:

MariaDB [(none)]> CREATE DATABASE powerdns;

Define permissions on mysql user ‘poplab’ to the database ‘powerdns

MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'poplab';
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'poplab';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> USE powerdns;

Create a table to locate the power DNS domains

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

Create a table to locate the power DNS records

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

Create database index’s needed:

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

Powerdns web interface

Download a Installation Script

Download Virtual Machine

https://www.powerdns.com/

Understanding Chroot Jails