Install and Configure PowerDNS with MySQL

Written by Mike on October 29, 2008 – 2:44 pm -

What is PowerDNS

PowerDNS is a versatile DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives and on Microsoft Windows. PowerDNS features a large number of different backends ranging from simple BIND style zonefiles to relational databases and load balancing/failover algorithms. A DNS recursor is also included as a separate program. (Definition as per wikipedia.org)

Installation of PHP, MySQL other required modules

Installation of PowerDNS and PDNS requires certain modules which are PHP(if you are going to install PowerAdmin web client too) Mysql, DB and MDB2. you can install all these modules using following commands:

yum install mysql mysql-devel mysql-server -y
yum install php-devel php-imap php-pear php-ldap php-gd php-mbstring php-ncurses php-xmlrpc php-domxml php-mysql php-odbc
pear install DB
pear install pear/MDB2#mysql

Creating Database and Tables

Once you install these modules, next step is to create Database for PDNS. To do that login to MySQL Console using mysql root password and execute following query to create database:

mysql> create database power_admin;

You can create any user as database user for power_admin. Here I have used root.

Next Step is to create Empty tables inside this database. Following are the SQL Queries to create tables

use power_admin;

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

GRANT SELECT ON supermasters TO power_admin;
GRANT ALL ON domains TO power_admin;
GRANT ALL ON records TO power_admin;


Installation and Configuration of PDNS

PDNS can be installed using YUM or using by the RPM provided by PowerDNS. Following is the command to install PDNS using yum

yum install pdns pdns-backend-mysql

Now we have to configure PDNS to work with MySQL Server. Open file /etc/pdns/pdns.conf which is configuration file for PDNS and search for “launch=bind” and change
FROM:

#################################
# launch        Which backends to launch and order to query them in
#
launch=bind
bind-example-zones

TO:

#################################
# launch        Which backends to launch and order to query them in
#
#launch=bind
#bind-example-zones
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=root
gmysql-password=root_password
gmysql-dbname=power_admin


Save and exit from the file.

Now restart the pdns Service using command “service pdns restart”. Now check if the server is responding to port 53 i.e. Port for DNS service. You can check that using telnet i.e. “telnet localhost 53″.

telnet Install and Configure PowerDNS with MySQL

If you get something like above image then pdns has been installed sucessfully on your Server/VPS.

You can go through This Article for installing and configuring PowerAdmin.


Tags: , ,
Posted in Dedicated Server Hosting, Linux VPS Hosting | 2 Comments »

2 Comments to “Install and Configure PowerDNS with MySQL”

  1. Installation of PowerAdmin Web Client | Says:

    [...] previous article I have explain how to install and configure PowerDNS with MySQL. Now, I am going to explain the steps to install PowerAdmin  which can be used as Web Client or [...]

  2. root zones Says:

    [...] you nice flowers after a month or so in the ground. The rest of the plant features grass like …What is PowerDNS | Install and Configure PowerDNS with MySQL …PowerDNS is a versatile DNS server, written in C++ and licensed under the GPL. It runs on most Unix [...]

Leave a Comment

RSS

  • Subscribe Me

  • Tag Cloud

  • Archives