How To Install PowerDNS on Ubuntu 14.04

Install PowerDNS on Ubuntu 14.04

For those of you who didn’t know, PowerDNS is a MySQL-based DNS server, written in C++ and licensed under the GPL. PowerDNS can be managed through a web interface (PowerAdmin). Unlike Bind, PowerDNS can be set up using a multitude of backends such as Bind Zone Files, or various Databases.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation PowerDNS on Ubuntu 14.04.

Install PowerDNS on Ubuntu 14.04

Step 1. First, you need to update the repository on your system.

apt-get update
apt-get upgrade

Step 2. Install MySQL.

apt-get install mysql-server mysql-client

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.

mysql_secure_installation

Step 3. Configuring MySQL.

Edit /etc/mysql/my.cnf to make MySQL to listen all interfaces:

nano /etc/mysql/my.cnf
[...]
#bind-address           = 127.0.0.1
[...]

Restart MySQL service:

service mysql restart

Step 4. Install the PowerDNS server and MySql backend.

apt-get install pdns-server pdns-backend-mysql

Step 5. Create a PowerDNS Database and User in MySQL.

Log in as a MySQL root and create a new database and tables:

mysql -u root -p
create database powerdns;
GRANT ALL PRIVILEGES ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'powerdnsPassword';
use powerdns;

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 UNIQUE INDEX name_index ON domains(name);

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 INDEX rec_name_index ON records(name);
CREATE INDEX nametype_index ON records(name,type);
CREATE INDEX domain_id ON records(domain_id);

CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);
exit;

Step 6. Configure PowerDNS.

Remove the existing PowerDNS configuration files:

sudo rm /etc/powerdns/pdns.d/*.*

Create file /etc/powerdns/pdns.d/pdns.local.gmysql.conf file:

nano /etc/powerdns/pdns.d/pdns.local.gmysql.conf

Add the following lines and set the correct database name and database user which we created earlier:

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

Finally, restart the PowerDNS service:

service pdns restart

Congratulations! You have successfully installed PowerDNS. Thanks for using this tutorial for installing PowerDNS on Ubuntu 14.04 system.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

Save