// Tutorial //

How To Install PowerDNS on CentOS 6.3 x64

Published on March 18, 2013
Default avatar
By Bulat Khamitov
Developer and author at DigitalOcean.
How To Install PowerDNS on CentOS 6.3 x64

Status: Deprecated

This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.

Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.

Step 1 - Install REMI and EPEL Repositories and Packages

rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum -y install php php-mcrypt php-pdo php-mysql pdns pdns-backend-mysql mysql-server httpd

Step 2 - Create a Database and Username

service mysqld start
service httpd start
mysqladmin create powerdns

Make sure to select your own password below:

mysql -Bse "create user 'powerdns'@'localhost' identified by 'password'"
mysql -Bse "grant all privileges on powerdns.* to 'powerdns'@'localhost'"

Step 3 - Create PowerDNS databases and tables:

Start mysql console with "mysql"

mysql> 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 mysql console by typing "exit":

mysql> exit

Step 4 - Install PowerAdmin

Login as root and run:

cd /root 
wget https://github.com/downloads/poweradmin/poweradmin/poweradmin-2.1.6.tgz
tar xvfz poweradmin-2.1.6.tgz
cd poweradmin-2.1.6/inc
mv config-me.inc.php config.inc.php

Edit config.inc.php and make sure to change password you've specified in Step 2:

nano config.inc.php

Modify db_pass and session_key to your own values:

$db_host                = 'localhost';
$db_port                = '3306';
$db_user                = 'powerdns';
$db_pass                = 'password';
$db_name                = 'powerdns';
$db_type                = 'mysql';
$session_key            = 'session_key';

Move PowerAdmin folder to Apache's DocumentRoot. We can use this droplet's IP address to manage our DNS settings

mv /root/poweradmin-2.1.6/* /var/www/html/
service httpd restart

Edit /etc/pdns/pdns.conf and add the following lines, make sure to modify gmysql-password to MySQL password you've selected in Step 2:

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

Restart Power DNS daemon:

service pdns restart

Step 5 - Create PowerAdmin Account

Proceed to installing PowerAdmin from webserver. Navigate over to your droplet's IP /install folder (in our case http://198.211.110.153/install/ ).

Create a Poweradmin admin account:

Next step is optional:

Finish the installation process, and after you get to Step 7, remove /var/www/html/install folder:

rm -rf /var/www/html/install

Now you can navigate to your droplet's IP ( http://198.211.110.153/ in our case), and login as admin with password you've specified in Step 5.

Now you can create your own DNS zone records:

You can verify that your new PowerDNS server is working by running dig against it:

dig @198.211.110.153 domain.com

;; ANSWER SECTION:
domain.com.             86400   IN      A       127.0.0.1

And you are all done!

By Bulat Khamitov

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.

Sign up
About the authors
Default avatar
Developer and author at DigitalOcean.

Still looking for an answer?

Was this helpful?
10 Comments

i was install pdns and pdns-backend-mysql, but while i type “dig @localhost” i got REFUSED., why?

@labura: Sounds like you somehow missed installing pdns-backend-mysql:

<pre> yum install pdns-backend-mysql </pre>

I found this Error in my /var/log/message… please help

May 22 15:22:37 ns-sec pdns[6337]: dnsbackend unable to load module in gmysql May 22 15:22:38 ns-sec pdns[6247]: Our pdns instance exited with code 1 May 22 15:22:38 ns-sec pdns[6247]: Respawning May 22 15:22:39 ns-sec pdns[6338]: Guardian is launching an instance May 22 15:22:39 ns-sec pdns[6338]: Reading random entropy from ‘/dev/urandom’ May 22 15:22:39 ns-sec pdns[6338]: Unable to load module ‘/usr/local/lib/libgmysqlbackend.so’: /usr/local/lib/libgmysqlbackend.so: cannot open shared object file: No such file or directory

I’m having problem that my pdns won’t resolve any zone… but I could input zone to database.

Hi

I followed your howto but cant get the answer while using “dig”. My installation gone smooth. Here I’m pasting some output. please check and guide me.

#dig @localhost domain.com A

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> @localhost aruhat.com ; (2 servers found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41627 ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; WARNING: recursion requested but not available

;; QUESTION SECTION: ;aruhat.com. IN A

;; AUTHORITY SECTION: aruhat.com. 3600 IN SOA 2014051900. 28800. 7200 604800 86400 604800 3600

;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Mon May 19 16:30:47 2014 ;; MSG SIZE rcvd: 79

#PDNS monitoring

[root@ldap ~]# /etc/init.d/pdns monitor May 19 16:33:25 Reading random entropy from ‘/dev/urandom’ May 19 16:33:25 This is module gmysqlbackend.so reporting May 19 16:33:25 This is a standalone pdns May 19 16:33:25 UDP server bound to 0.0.0.0:53 May 19 16:33:25 TCP server bound to 0.0.0.0:53 May 19 16:33:25 PowerDNS Authoritative Server 3.3.1 (jenkins@autotest.powerdns.com) © 2001-2013 PowerDNS.COM BV May 19 16:33:25 Using 64-bits mode. Built on 20131217194128 by mockbuild@, gcc 4.4.7 20120313 (Red Hat 4.4.7-4). May 19 16:33:25 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2. May 19 16:33:25 Set effective group id to 490 May 19 16:33:25 Set effective user id to 495 May 19 16:33:25 Creating backend connection for TCP May 19 16:33:25 Master/slave communicator launching May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. % May 19 16:33:25 About to create 3 backend threads for UDP May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 No new unfresh slave domains, 0 queued for AXFR already May 19 16:33:25 No master domains need notifications May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 Done launching threads, ready to distribute questions

Hi

I followed your howto but cant get the answer while using “dig”. My installation gone smooth. Here I’m pasting some output. please check and guide me.

#dig @localhost domain.com A

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> @localhost aruhat.com ; (2 servers found) ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41627 ;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; WARNING: recursion requested but not available

;; QUESTION SECTION: ;aruhat.com. IN A

;; AUTHORITY SECTION: aruhat.com. 3600 IN SOA 2014051900. 28800. 7200 604800 86400 604800 3600

;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Mon May 19 16:30:47 2014 ;; MSG SIZE rcvd: 79

#PDNS monitoring

[root@ldap ~]# /etc/init.d/pdns monitor May 19 16:33:25 Reading random entropy from ‘/dev/urandom’ May 19 16:33:25 This is module gmysqlbackend.so reporting May 19 16:33:25 This is a standalone pdns May 19 16:33:25 UDP server bound to 0.0.0.0:53 May 19 16:33:25 TCP server bound to 0.0.0.0:53 May 19 16:33:25 PowerDNS Authoritative Server 3.3.1 (jenkins@autotest.powerdns.com) © 2001-2013 PowerDNS.COM BV May 19 16:33:25 Using 64-bits mode. Built on 20131217194128 by mockbuild@, gcc 4.4.7 20120313 (Red Hat 4.4.7-4). May 19 16:33:25 PowerDNS comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it according to the terms of the GPL version 2. May 19 16:33:25 Set effective group id to 490 May 19 16:33:25 Set effective user id to 495 May 19 16:33:25 Creating backend connection for TCP May 19 16:33:25 Master/slave communicator launching May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. % May 19 16:33:25 About to create 3 backend threads for UDP May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 No new unfresh slave domains, 0 queued for AXFR already May 19 16:33:25 No master domains need notifications May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 gmysql Connection successful. Connected to database ‘powerdns’ on ‘localhost’. May 19 16:33:25 Done launching threads, ready to distribute questions

I’m getting stuck when asked to start mysql, for some reason I’m getting access denied errors. Please see the error below:

[root@ns1 ~]# mysql ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO) [root@ns1 ~]# mysql -p Enter password: ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES) [root@ns1 ~]# mysql -u -p ERROR 1045 (28000): Access denied for user ‘-p’@‘localhost’ (using password: NO) [root@ns1 ~]# mysql ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: NO)

Any idea how to solve this? I’d love to get this up and running asap.

Nevermind. There was a type in my pdns.conf. slaps self

This tutorial is good, except for some reason PDNS refuses to listen on port 53… Any ideas?

thanks for this tutorials