Install & Configure PowerDNS with MySQL on RHEL/CentOS 6x
Q. What is PowerDNS?
-- PowerDNS is a DNS server, written in C++ and licensed under the GPL. It runs on most Unix derivatives. 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 provided as a separate program.
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
Step: 2. Installing MySQL Server :
# yum -y install mysql mysql-server
Step: 3. Set MySQL Root Password :
# service mysqld restart
# chkconfig mysqld on
# mysql_secoure_installation
Step: 4. Install Apache Server & PHP :
# yum -y install httpd httpd-devel php php-mcrypt php-pdo php-mysql php-devel php-gd \
php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring gettext wget
Step: 5. Restart Apache Server :
# service httpd restart
# chkconfig httpd on
Step: 6. Install following two PEAR Packages :
# yum -y install php-pear-DB php-pear-MDB2-Driver-mysql
Step: 7. Create a Database for PowerDNS :
# mysql -u root -predhat
mysql> create database powerdns;
mysql> grant all privileges on powerdns.* to powerdns@'localhost' identified by 'password';
mysql> grant all privileges on powerdns.* to powerdns@'%' identified by 'password';
Step: 8. Create Tables :
mysql> use 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> flush privileges;
mysql> quit;
Step: 9. Install & Configure PowerDNS :
# yum -y install pdns pdns-backend-mysql
# vi /etc/pdns/pdns.conf
#################################
# launch Which backends to launch and order to query them in
#
# launch=
launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=password
gmysql-dbname=powerdns
#################################
-- Save & Quit (:wq)
# service pdns restart
# chkconfig pdns on
Step: 10. Install PowerAdmin :
# cd /var/www/html
# wget https://github.com/downloads/poweradmin/poweradmin/poweradmin-2.1.6.tgz
# tar xvfz poweradmin-2.1.6.tgz
# mv poweradmin-2.1.6 poweradmin
# cd poweradmin/inc/
# mv config-me.inc.php config.inc.php
Step: 11. Edit config.inc.php & make sure to change password you've specified in Step 7 :
# vi 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 = 'Passw0rd';
-- Save & Quit (:wq)
# service httpd restart
Step: 12. Create PowerAdmin Account :
http://192.168.72.140/poweradmin
Click on Install -> Choose I prefer to proceed in English -> Go to Step2 -> Go to Step3 ->
Username: powerdns
Password: password
Database Type: MySQL
Hostname: 127.0.0.1
DB Port: 3306
Database: powerdns
PowerAdmin Administrator Password: Passw0rd
Go to Step4 -> This step is optional (SKIP) -> Go to Step5 -> Go to Step6 -> Go to Step7.
Note: Now we have finished the configuration, you should (must!) remove the directory "install/"
# cd /var/www/html/poweradmin
# mv install/ install_bak
Step: 13. Now you can login as Admin :
http://192.168.72.140/poweradmin
User: admin
Pass: Passw0rd
Thanks For Visiting on My Blog, For More Tutorials Keep Visiting My Blog
Hello! Your tutorial articles are great and detailed, suitable for the time being. You can help me install dns server with bind, and use nsupdate to update the sub-domains. Thanks!
ReplyDelete