Installing PowerDNS With MySQL On CentOS

Want to support HowtoForge? Become a subscriber!
 
Submitted by rhein.andrea (Contact Author) (Forums) on Tue, 2010-03-23 11:07. :: CentOS | PowerDNS | DNS

Installing PowerDNS With MySQL On CentOS

What is PowerDNS?

PowerDNS is a MySQL-based DNS server, written in C++ and licensed under the GPL. PowerDNS can be managed through a web interface (PowerAdmin). This guide shows how to install it on CentOS.

 

1. Installing MySQL

[root@server ~]# yum -y install mysql mysql-server

 

2. Create system startup links for MySQL

[root@server ~]# chkconfig --levels 235 mysqld on

[root@server ~]# service mysqld start

 

3. Check if MySQL is running

[root@server ~]# netstat -tap | grep mysql

tcp        0      0 *:mysql                 *:*     LISTEN   28179/mysqld 

 

4. Set password for user root

[root@server ~]# mysqladmin -u root password password123

 

5. Install PowerDNS

[root@server ~]# yum -y install pdns pdns-backend-mysql

 

6. Setting database

[root@server ~]# mysql -u root -p

mysql> CREATE DATABASE powerdns;

mysql> user powerdns;

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

mysql> CREATE UNIQUE INDEX name_index ON domains(name);

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

mysql> CREATE INDEX rec_name_index ON records(name);

mysql> CREATE INDEX nametype_index ON records(name,type);

mysql> CREATE INDEX domain_id ON records(domain_id);

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

mysql> quit;

[root@server ~]# nano /etc/pdns/pdns.conf

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

launch=gmysql

gmysql-host=192.200.200.1

gmysql-user=power_admin

gmysql-password=password123

gmysql-dbname=powerdns

#################################

 

7. Create the system startup links for PowerDNS

[root@server ~]# chkconfig --levels 235 pdns on

[root@server ~]# service pdns start

 

8. Preparing the system for PowerAdmin installation

[root@server ~]# yum -y install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext

 

9. Create system startup links for apache and start it

[root@server ~]# chkconfig --levels 235 httpd on

[root@server ~]# service httpd start

 

10. Install following two PEAR packages

yum -y install php-pear-DB php-pear-MDB2-Driver-mysql

 

11. Download PowerAdmin

[root@server ~]# wget https://www.poweradmin.org/download/poweradmin-2.1.2.tgz

[root@server ~]# tar zxvf poweradmin-2.1.2.tgz -C /var/www/html/

[root@server ~]# mv poweradmin-2.1.2 poweradmin

[root@server ~]# mv /var/www/html/poweradmin/inc/config.inc.php

[root@server ~]# chown -R apache:apache /var/www/html/poweradmin/


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Anonymous (not registered) on Sun, 2011-01-30 10:01.

In paragraph 6. There's edited pdns.conf with mysql connection settings, but there's not told what user to use. Power_admin user is not created, should we use root? Also host is something from your own config. I know what to use and do, but someone else could be lost.

There's also other error in paragraph 11. It says "mv poweradmin-2.1.2 poweradmin", but poweradmin is unpacked under /var/www/html so you're in wrong directory. Needed to be "mv /var/www/html/poweradmin-2.1.2 /var/www/html/poweradmin"

Poweradmin also needed to be installed through browser. So at the end, go to http://your-ip-address/poweradmin/install and follow the instructions

 

Submitted by Frank (not registered) on Mon, 2010-05-03 21:55.
Hi,

first of al a big thank you for offering this description.

I think I found two mistakes:

1) The third action in paragraph 6 is:

mysql> user powerdns;

This results in a sql-error - I think the line should be:
mysql> use powerdns;

2) In paragraph 11 the forth action is:

[root@server ~]# mv /var/www/html/poweradmin/inc/config.inc.php

This makes no sense and ends into an os-error - is there probably missing a dot?

Finally I do habe problems with paragraph 10. I get the following error messages:

Running Transaction
Installing : php-pear-MDB2 1/3
/tmp/glibctestsbd3OB:1:22: Fehler: features.h: Datei oder Verzeichnis nicht gefunden
Installing : php-pear-MDB2-Driver-mysql 2/3
/tmp/glibctestCeKuaK:1:22: Fehler: features.h: Datei oder Verzeichnis nicht gefunden
Installing : php-pear-DB 3/3
/tmp/glibctestzGj560:1:22: Fehler: features.h: Datei oder Verzeichnis nicht gefunden

What do I need to do to avoid them?

And a last question - I should see apache at the servers ip, right? In fact I don't ...

Best regards,
Frank
Submitted by Anonymous (not registered) on Tue, 2010-03-23 21:16.

Hello

Are you also able to create a howto on setting up a secondary name server, no one seems to be doing those.

 

A secondary slave name server that gets its records from the primary powerdns name server

Submitted by K. Larsen (not registered) on Fri, 2010-03-26 13:02.

Wouldn't you just setup MySQL to replicate the DB and/or point the new PowerDNS to the same MySQL server.

I would probably setup 2 MySQL servers which replicate the DB, either as A/S or A/A and then point the PowerDNS servers accordingly.

Submitted by Glen Lumanau (not registered) on Thu, 2010-03-25 09:53.
as I read the documentation of PowerDNS, PowerDNS using mysql replication for master/slave configuration. CMIIW 
Submitted by rhein.andrea (registered user) on Thu, 2010-03-25 09:07.

I have create tutorial for dns slave, check this link

http://www.howtoforge.com/installation-of-bind-as-a-secondary-slave-dns-server-on-centos

 let me know if you have problem again, thank you.

 Rhesa.