How To Install PowerDNS, MariaDB and Poweradmin on Ubuntu Linux 14.04


Domain name server (DNS) is a machine that hold information about domains and its address. It maintain IP address information of domain and can be translate to hostname. PowerDNS is a freely available high performance DNS server program runs on Linux machine. It read information from backend database and support Bind. In this tutorial we are going to process of installing PowerDNS using MariaDB as a database backend and Power admin to manage DNS server under linux ubuntu 14.04.

DNS Architecture

The architecture of DNS server we plan to install can be draw below.     PowerDNS is use database (MariaDB) to store domain information and power admin as a interface for administrator to manage domain record information.

Prepare Ubuntu Machine

We are need root access for the rest of installation process or at least sudo-er privilege. It is always a good step to update the linux system to the latest release before install any software.

  • apt-get update && apt-get upgrade -y

Wait until update process is complete.

Install MariaDB

So, Why is MariaDB ? Well, it is free. Why is not MySQL ? Many people concern about the plan to keep MySQL alive. MariaDB in other hand is a fork of MySQL, developed by MySQL developer and some other advantages are not cover in this article. Checking properties common

  • sudo apt-get install software-properties-common

Property Common checking

Import MariaDB public key

  • sudo apt-key adv –recv-keys –keyserver hkp:// 0xcbcb082a1bb943db

Adding MariaDB to repository

Reload database package. Install MariaDB with apt-get.

  • sudo apt-get update

  • sudo apt-get install mariadb-server

Enter root password for MariaDB Confirm password when prompt.

Hardening and Configure MariaDB Installation

Some security concern came with initial install. We need to close these holes with following steps, but first we want to create directory structure and start MariaDB.

  • sudo mysql_install_db

  • sudo service mysql start

Run wizard to hardening MariaDB installation.

  • mysql_secure_installation

  Enter MariaDB root password when prompt.   - Remove anonymous users? Yes

  • Disallow root login remotely? Yes

  • Remove test database and access to it? Yes

  • Reload privilege tables now? Yes

Now, MariaDB is ready to use.

Add PowerDNS User in MariaDB

PowerDNS use database to store domain information. All domain record, ip addresses, hostname and such will be store in database and refer when request. Access newly install MariaDB database.  

  • mysql -u root -p

  • enter MariaDB root password


  • CREATE DATABASE powerdns;

Create a new database user for powerdns database call ‘powerdnsusr’ with password ‘userpass’. Please choose your own password by replace ‘userpass’ with your own choice.

  • GRANT ALL ON powerdns.* TO ‘powerdnsusr’@‘localhost’ IDENTIFIED BY ‘userpass’;

Update user setting


    Next step, we will fill database with recommended table to operate powerdns. Select database to use

Use powerdns;

Create a table call ‘domains’

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

Set table domain ‘name’ as a index.

  • CREATE UNIQUE INDEX name_index ON domains(name);


** Next Step, Create another table call ‘record’  **

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

  Set indexes on table record.  

  • CREATE INDEX rec_name_index ON records(name); CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id);

  Next step, create table call ‘supermaster’  

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

This is the last table. Now, we can exit database and back to linux prompt.

  • quit;

Install PowerDNS

Since we have dabatase and tables created, we continue to install PowerDNS. Run following command to install powerdns.  

  • sudo apt-get install pdns-server pdns-backend-mysql

When prompt for configuration below, choose ‘NO’ we will configure manually.

Set PowerDNS Configuration

Before we use powerDNS, We need to set some configuration. Browse to PowerDNS configuration location.

  • $cd /etc/powerdns/pdns.d
  • $ls -al
  • $rm *

Next step, We would like to connect PowerDNS with database by editing configuration file pdns.local.gmysql.conf.

  • $cd /etc/powerdns/pdns.d/
  • $sudo nano pdns.local.gmysql.conf

A new file will be created. Insert line below, save and exit.

### MySQL Configuration file - launch=gmysql - gmysql-host=localhost - gmysql-port=3306 - gmysql-dbname=powerdns - gmysql-user=powerdnsusr - gmysql-password=userpass

Testing powerDNS listening from terminal.

  • netstat -tap

You should see something like …LISTEN ….. pdns_server-in.

Install PowerAdmin

Continue …