Install PowerDNS and PowerAdmin on an Ubuntu 14.04 VPS

install-powerdns-and-poweradmin-on-an-ubuntu-14-04-vpsIn this tutorial, we will show you how to install PowerDNS and Poweradmin on an Ubuntu 14.04 VPS with Nginx, MariaDB and PHP-FPM. PowerDNS is an open source, high-performance and reliable DNS server, written in C++ and can be used as an alternative to BIND. Poweradmin is a free, web-based administration tool for PowerDNS written in PHP. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 14.04 VPS.

Login to your VPS via SSH

ssh user@vps

Update the system and install necessary packages

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common vim git

Install MariaDB 10.0

To install MariaDB, run the following commands:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
[user]$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.0/ubuntu trusty main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

When the installation is complete, run the following command to secure your installation:

[user]$ mysql_secure_installation

Install PowerDNS

To install the latest version of PowerDNS just run:

[user]$ sudo apt-get install pdns-server pdns-backend-mysql

Select Yes to create and configure database for pdns-backend-mysql with dbconfig-common. Provide the password of the database’s administrative user (MySQL root user password) and choose a password for the pdns-backend-mysql user.

The database information will be written to the pdns.local.gmysql.conf file.

[user]$ sudo cat /etc/powerdns/pdns.d/pdns.local.gmysql.conf
# MySQL Configuration
#
# Launch gmysql backend
launch=gmysql

# gmysql parameters
gmysql-host=localhost
gmysql-port=
gmysql-dbname=pdns
gmysql-user=pdns
gmysql-password=yourPdnsUserPassword
gmysql-dnssec=yes
# gmysql-socket=

Clone Poweradmin

Clone the project repository from GitHub:

[user]$ git clone https://github.com/poweradmin/poweradmin.git /var/www/html/pdns.myDomain.com/

Set the correct permissions:

[user]$ chown -R www-data: /var/www/html/pdns.myDomain.com/

Install and configure PHP and required PHP modules

To install the latest stable version of PHP version 5.6 and all nessesary modules, run:

[user]$ sudo add-apt-repository -y ppa:ondrej/php5-5.6
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install php5-fpm php5-cli php5-gd php5-mysqlnd php5-mcrypt

Edit the PHP-FPM pool configuration file:

[user]$ sudo mv /etc/php5/fpm/pool.d/www.conf{,.bak}
[user]$ sudo vim /etc/php5/fpm/pool.d/www.conf
[www]
user = www-data
group = www-data
listen = /var/run/php5-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s;
pm.max_requests = 200
chdir = /

Restart PHP-FPM:

[user]$ sudo service php5-fpm restart

Install and configure Nginx

Ubuntu 14.04 comes with nginx version 1.4, to install the latest stable version of Nginx version 1.8, run:

[user]$ sudo add-apt-repository -y ppa:nginx/stable
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

Create a new Nginx server block with the following content:

[user]$ sudo vim /etc/nginx/sites-available/pdns.myDomain.com
server {
    server_name pdns.myDomain.com;
    listen 80;
    root /var/www/html/pdns.myDomain.com;

    access_log /var/log/nginx/pdns-access.log;
    error_log /var/log/nginx/pdns-error.log;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }

    location ~ /\.ht {
        deny all;
    }    
}

Activate the server block by creating a symbolic link :

[user]$ sudo ln -s /etc/nginx/sites-available/pdns.myDomain.com /etc/nginx/sites-enabled/pdns.myDomain.com

Test the Nginx configuration and restart nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Install Poweradmin

To start the installation wizard, open your browser and type http://pdns.myDomain.com/installer

Step 1: Select the desired language,
Step 2: Click on the “Go to step 3” button
Step 3: Fill the database information fields:
– Username: pdns
– Password: yourPdnsUserPassword
– Database type: MySQL
– Hostname: localhost
– DB Port: 3306
– Database: pdns
– Poweradmin administrator password: setYourPoweradminAdminPassword
Step 4: Set the username and password for Poweradmin, Hostmaster and Primary and Secondary nameservers.
Step 5: Before going to next step, perform the mariadb command shown on the screen.

[user]$ mysql -uroot -p
GRANT SELECT, INSERT, UPDATE, DELETE
ON pdns.*
TO 'yourUser'@'localhost'
IDENTIFIED BY 'yourUserPassword';
\q

Step 6: If you have set the correct permissions the installer will create a Poweradmin php configuration file.
After the installation wizard completes, remove the install directory using the following command:

[user]$ rm -rf install/

That’s it, you have successfully installed PowerDNS and Poweradmin on your VPS!

You can now login to the Poweradmin interface using admin as username and setYourPoweradminAdminPassword as password.


Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to set this up for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Leave a Comment