Up to $100 off Dedicated Servers

Install PowerDNS and MariaDB on an Ubuntu 16.04 Server

Posted on by Nathaniel Swanson | Updated:
Reading Time: 4 minutes

What is PowerDNS?

PowerDNS (pdns) is a DNS server written in C++. It originally started as proprietary software but was released in 2002 under the open-source GPL license. It is widely used for DNS hosting and is one of the most popular DNS servers for hosting domains using DNSSEC. It can be installed on most UNIX type operating systems. It features support for a large number of backends, including but not limited to MySQL, SQLite3, PostgreSQL, Oracle, Sybase, LDAP, Microsoft SQL Server, and BIND like plain text files. It also has a built-in web server for use with their JSON/REST API. PowerDNS can be the authoritative name server for your domains but can also be used as a recursive DNS resolver. The PowerDNS Authoritative Server and the PowerDNS Recursor are separate programs.

The PowerDNS Authoritative Server (pdns_server) provides the definitive DNS records (e.g. A, MX, TXT, CNAME, etc.) for a particular domain. It only provides DNS for domains that it contains DNS records for.

In contrast, the PowerDNS Recursor (pdns_recursor) is a resolving DNS server. It provides DNS records to the end user from the authoritative DNS server. The server provides DNS caching, resolving, and recursing. When the end user requests a DNS record the recursor checks to see if the request has been cached. If not, the recursor then makes the request to the authoritative DNS server. DNS queries are cached based on TTL (time to live) values. The pdns_recursor does not require the pdns_server to function. In fact, the pnds_recursor has better performance when not used behind the authoritative server. The pnds_recursor is used widely across the Internet by well-known companies such as Shaw Cable, Neuf Cegetel and AOL. It is not generally recommended to run public recursive DNS servers, due to the security implications.


Caching with PowerDNS

PowerDNS has good performance with lower memory usage. It provides Packet Cache by default. PowerDNS uses this cache to provide the answer to queries that were previously run. It does this without further processing of the request. The TTL is set to 20 seconds for the Packet Cache by default. In addition to Packet Cache, PowerDNS also uses Query Cache for caching backend queries. The most common backend queries are for CNAME lookups. For example, if a user requests the A record for www.liquidweb.com, the server first has to look up the CNAME record for www.liquidweb.com. Future requests for www.liquidweb.com will be pulled from the cache first until the TTL expires. The Query Cache also caches negative queries, meaning queries that don’t provide an answer. Caching negative queries provides the most performance gain. The queries require very little memory to store and generally do not pose a problem in terms of the speed at which they propagate, the default TTL for negative queries is 60 seconds.


Why Choose PowerDNS?

With all the DNS servers out there why choose PowerDNS? The vast number of databases PowerDNS supports, along with caching and DNSSEC implementation make PowerDNS a good choice when it comes to choosing a DNS server. Depending on the type of backend you are using or want to use, it may be one of the only options.

BIND is another popular choice when it comes to DNS servers. BIND is the most popular and de facto standard on Linux operating systems. It can handle both authoritative DNS queries as well as recursive DNS queries. BIND supports the following database types including LDAP, Berkeley DB, MySQL, PostgreSQL, and ODBC. It also supports DNSSEC. However, it typically uses more memory and has slower performance compared to PowerDNS.

In this guide, we’ll show you how to install MariaDB and PowerDNS on an Ubuntu server running Ubuntu 16.04. The only thing you will need for this is an Ubuntu VPS server with an Internet connection and a user with sudo privileges.


Install MariaDB

First set up the repository for the current stable version:

sudo apt-get install software-properties-common

sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8

sudo add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://ftp.utexas.edu/mariadb/repo/10.2/ubuntu xenial main'

Then install MariaDB:

sudo apt update

sudo apt install mariadb-server

While installing it will ask you to set the root password:When first installing MariaDB you'll be asked to set the root password.

Then it will ask you to confirm that password:When first setting up MariaDB, you'll be asked to confirm your root password.


Install PowerDNS

sudo apt install pdns-server pdns-backend-mysql

During installation, pdns-backend-mysql will ask whether or not you want it to “Configure database for pdns-backend-mysql with dbconfig-common”?

Select Yes. On the next screen, it will ask you for a password for MySQL.During installation, pdns-backend-mysql will ask whether or not you want it to “Configure database for pdns-backend-mysql with dbconfig-common”? Select Yes.

Simply select <OK>. This will set up a MariaDB database for PowerDNS called pdns and create a database user with a randomly generated password. The configuration file for the MariaDB connection can be edited in /etc/powerdns/pdns.d/pdns.local.gmysql.conf, if needed.

You can check the status of the programs by running:

systemctl status pdns.service

systemctl status mariadb.service

You can now edit DNS using MariaDB. Of course, many users choose to use Poweradmin or scripts instead.  In our next tutorial, we’ll be showing you how to easily install and managed your DNS via Poweradmin.


Avatar for Nathaniel Swanson

About the Author: Nathaniel Swanson

Latest Articles

How to install Redis on Linux (AlmaLinux)

Read Article

How to use NextCloud — setup and features

Read Article

Use ChatGPT to diagnose and resolve server issues

Read Article

What is SDDC VMware?

Read Article

Best authentication practices for email senders

Read Article