How to Install PowerDNS DNS Server on Ubuntu

2151

PowerDNS is a powerful DNS server like Bind9. But PowerDNS is much more flexible because PowerDNS uses a database such as MySQL, PostgreSQL, SQLite etc to store it’s DNS entries.

So it’s very flexible and you can easily write custom web apps with PHP, Python, Node.js, Ruby etc to add, remove, and modify DNS entries.

In this article, I am going to show you how to install PowerDNS DNS server on Ubuntu and configure it to use MySQL database.

To follow this tutorial, you need,

    – A computer or virtual machine with Ubuntu server or Desktop installed.

    – Internet connection for downloading MySQL server and PowerDNS server packages.

    – Basic understanding of Linux command line.

Installing MySQL Server:

Before you install PowerDNS, you must install MySQL server if you want to use it as a database backend. Otherwise the installation won’t go smoothly. In this case, I do want to use MySQL as the database backend. So I am going to install MySQL server first for the sake of simplicity.

To install MySQL, run the following command.

$ sudo apt-get update

$ sudo apt-get -y install mysql-server mysql-client

MySQL server should ask you for the root password. Give it the password. Remember this password is not the same as your operating systems root password. So you can give it anything. I gave it, 123 as the root password of MySQL. It’s not the most secure password, but for a demo it works.

Installing PowerDNS

Now that the MySQL server is installed, we can install PowerDNS.

To install PowerDNS, run the following command.

$ sudo apt-get -y install pdns-server pdns-backend-mysql

PowerDNS should show you this dialog while installation.

Just press “Enter”.

Then you should see prompt.

It asks you whether you want to configure MySQL server for PowerDNS now. Yes we do. Select “Yes” and press “Enter“.

Now you should be prompted for your MySQL password. It’s 123 if you’re following along. Type in the password, select “Ok” and press “Enter”.

Now confirm your password by re-typing it.

Now PowerDNS is installed successfully. 

You can check if the DNS server is running with the following command.

$ sudo service pdns status

That’s it. Now you can add DNS entries to PowerDNS using MySQL. You can login to your MySQL database as user ‘pdns’ and host ‘localhost’ with the password ‘123’ and select the database ‘pdns’ and insert data to it. For more information, go to the official website of PowerDNS at https://doc.powerdns.com/md/authoritative/ .