Installing and Configuring PowerDNS on CentOS

  • by

Installing and Configuring PowerDNS with PowerAdmin from Source

Pre-requisites
==============
# yum group install ‘Development Tools’
# yum install libxml2-devel gd gd-devel libmcrypt-devel libmcrypt libmhash curl curl-devel libtool-ltdl-devel libtool-ltdl libpng-devel imagemagick ncurses ncurses-devel pce-devel zlib-devel bzip2-devel

Apache 2.2.15
=============
# cd /usr/local/src
# wget http://mirror.its.uidaho.edu/pub/apache/httpd/httpd-2.2.15.tar.gz
# tar zxvf httpd-2.2.15.tar.gz
# cd httpd-2.2.15
# ./configure –prefix=/usr/local/apache2 –enable-so –enable-deflate –enable-proxy –enable-proxy-connect –enable-proxy-http –enable-proxy-ajp –enable-proxy-balancer –enable-ssl –enable-unique-id –enable-usertrack –enable-vhost-alias –with-mpm=prefork –enable-static-ab –enable-rewrite
# make
# make install
# vi /usr/local/apache2/conf/httpd.conf
# /usr/local/apache2/bin/apachectl start

MySQL 5.1.45
============
#wget http://www.mirrorservice.org/sites/ftp.mysql.com/Downloads/MySQL-5.1/mysql-5.1.45.tar.gz
# tar zxvf mysql-5.1.45.tar.gz
# cd mysql-5.1.45
# ./configure –prefix=/usr/local/mysql –with-low-memory –enable-assembler –with-mysqld-ldflags=-all-static –with-plugins=partition,archive,innobase,myisam
# make
# make install
# /usr/sbin/groupadd mysql
# /usr/sbin/useradd -g mysql mysql
# cd /usr/local/mysql/
# chown -R mysql .
# chgrp -R mysql .
# bin/mysql_install_db
# chown -R root .
# chown -R mysql var
# bin/mysqld_safe -user=mysql &
# /usr/local/mysql/bin/mysqladmin -u root password the_password

PHP 5.3.2
=========
# wget http://my2.php.net/get/php-5.3.2.tar.gz/from/us.php.net/mirror
# tar zxvf php-5.3.2.tar.gz
# cd php-5.3.2
# ./configure \
–prefix=/usr/local/php5 \
–with-apxs2=/usr/local/apache2/bin/apxs \
–with-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–enable-force-cgi-redirect \
–enable-fastcgi \
–with-gd \
–enable-soap \
–with-pear \
–enable-mbstring \
–with-mcrypt \
–with-curl \
–with-zlib \
–with-bz2 \
–enable-zip \
–enable-shared
# make
# make install
# libtool –finish /usr/src/php/php-5.3.2/libs
# vi /usr/local/apache2/conf/httpd.conf
  Add this line:
  AddType application/x-httpd-php .php
# /usr/local/apache2/bin/apachectl stop
# /usr/local/apache2/bin/apachectl start
# vi /usr/local/apache2/htdocs/info.php
 <?php
   phpinfo();
 ?>

phpMyAdmin 3.3.1
================
# cd /usr/local/src
# wget http://space.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.1/phpMyAdmin-3.3.1-english.tar.gz
# cp phpMyAdmin-3.3.1-english.tar.gz /usr/local/apache2/htdocs
# cd /usr/local/apache2/htdocs
# tar zxvf phpMyAdmin-3.3.1-english.tar.gz
# mv phpMyAdmin-3.3.1-english phpMyAadmin
# cd phpMyAdmin
# cp config.sample.inc.php config.inc.php
# mkdir config
# chmod o+rw config
# cp config.inc.php config/
# chmod o+w config/config.inc.php
Now, open setup/ in browser
# mv config/config.inc.php .
# chmod o-w config.inc.php
# rm -rf config

PowerDNS 2.9.22
===============
# cd /usr/local/src
# wget http://downloads.powerdns.com/releases/pdns-2.9.22.tar.gz
# tar zxvf pdns-2.9.22.tar.gz
# cd mydns-2.9.22
# ./configure \
–with-mysql=/usr/local/mysql \
–with-mysql-lib=/usr/local/mysql/lib/mysql \
–with-mysql-include=/usr/local/mysql/include/lib/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–with-included-gettext \
–enable-shared
# make
# make install
# cd /usr/local/etc/
# cp pdns.conf-dist pdns.conf
# vi pdns.conf
launch=gmysql
gmysql-host=127.0.0.1
gmysql-user=root
gmysql-password=dbpassword
gmysql-dbname=pdns
mysql> create database pdns;
mysql> use pdns;
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)
)type=InnoDB;

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)
)type=InnoDB;

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 pdns;
GRANT ALL ON domains TO pdns;
GRANT ALL ON records TO pdns;

# /usr/local/sbin/pdns_server &

# host www.test.com 127.0.0.1

mysql> use pdns;
mysql> INSERT INTO domains (name, type) values (‘test.com’, ‘NATIVE’);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’test.com’,’localhost ahu@ds9a.nl 1′,’SOA’,86400,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’test.com’,’dns-us1.powerdns.net’,’NS’,86400,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’test.com’,’dns-eu1.powerdns.net’,’NS’,86400,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’www.test.com’,’199.198.197.196′,’A’,120,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’mail.test.com’,’195.194.193.192′,’A’,120,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’localhost.test.com’,’127.0.0.1′,’A’,120,NULL);
 INSERT INTO records (domain_id, name, content, type,ttl,prio)
 VALUES (1,’test.com’,’mail.test.com’,’MX’,120,25);

# host www.test.com 127.0.0.1
# host -v -t mx test.com 127.0.0.1

Poweradmin-2.1.4
================
# wget https://www.poweradmin.org/download/poweradmin-2.1.4.tgz
# tar xvfz poweradmin-2.1.4.tgz
# mv poweradmin-2.1.4 /usr/local/apache2/htdocs/poweradmin
# chown -R apache:apache /usr/local/apache2/htdocs/poweradmin
Now, open install/ in browser

# wget http://downloads.powerdns.com/releases/pdns-recursor-3.2.tar.bz2ns

Leave a Reply