PowerDNS is a free, open-source, and cross-platform authoritative nameserver written in C++. It comes with features to create authoritative DNS, Recursive DNS, DNS loading balancer, and many more. If you are looking for a fast, scalable, and efficient DNS platform to manage your DNS zones, then PowerDNS should be considered. It supports several databases such as MySQL, MariaDB, PostgreSQL, and Oracle to store zone files and records. Below we will show you how to install and use PowerDNS in Ubuntu Linux.
How to install PowerDNS and PowerDNS Admin tool on Ubuntu Linux
As described above, PowerDNS is a free, open-source, and cross-platform authoritative nameserver written in C++. It comes with features to create authoritative DNS, Recursive DNS, DNS loading balancer, and more. PowerDNS Admin is a web-based application used to manage PowerDNS from one’s browser. To get started, follow the steps below:
Install the MariaDB database server
For this article, we’re going to be using the MariaDB database server to store PowerDNS zone records. To learn how to install MariaDB, read the post below: How to install MariaDB database server on Ubuntu Linux Once you have installed MariaDB, run the commands below to create a database and user to use with PowerDNS. Connect to MariaDB SQL console: Then create a database pdns and a user named pdnsadmin with a new password. Save your changes and exit.
Install PowerDNS
Now that you have installed MariaDB and created a new database and user, continue below to download and install PowerDNS. First, make sure to disable systemd-resolved service that comes with Ubuntu Linux. Since PowerDNS is going to be our premier DNS resolver, remove the default resolver by running the commands below. Next, remove the current resolv.conf file, and create a new one with your preferred external DNS nameserver. Google nameserver is a good choice. Finally, install PowerDNS using the commands below. Once PowerDNS is installed above, run the commands below to import the PowerDNS database schema to the MariaDB database created above. When prompted for a password, use the one created above.
Configure PowerDNS
After the database stuff above, create a PowerDNS configuration file and define the PowerDNS database connection details in it. Then copy the details below into the file and save. Save the file and exit Run the commands below to protect the config file above. Next, test the PowerDNS service to make sure all is configured correctly. If all is well, you should see connected and successful messages as output. Start PowerDNS again by running the commands below. PowerDNS is now installed and working.
Install the PowerDNS Admin web application
To manage PowerDNS intuitively via your browser, you can install the PowerDNS admin tool. First, install the prerequisite for PowerDNS admin. Next, install Node.js and Yarn. Run the commands line by line as listed below. You should now have all the dependencies to run the PowerDNS Admin tool. Next, download the PowerDNS package via git. They change the pdns directory and create and activate a Python virtual environment. Next, create PowerDNS database connection details to the default_config.py file for PowerDNS Admin configuration. Next, make sure the highlighted lines match your database name, username and password. Save the file and exit. Next, activate the virtual environment, download, and configure all settings, then deactivate by running the commands below. Again, run the commands line by line as listed below. To enable the API, the webserver and the HTTP API need to be enabled. Run the commands below to open the pdns.conf file. Then add these lines to the pdns.conf file and save. Restart PowerDNS
Create Nginx reverse proxy
You will want to create an Nginx proxy to access PowerDNS via a web browser. Run the commands below to create a proxy configuration file. Then copy and paste the code below into the file and save. Next, change the ownership for pdns directory to pdns and www-data. Restart Nginx
Create PowerDNS Admin systemd service
To be able to easily manage to start and stop PowerDNS Admin, you will want to create a systemd service for PowerDNS Admin. Run the commands below to create a systemd file. Then copy and paste the lines below into the file. Save and exit. Create a pdnsadmin socket file by running the commands below. Then copy and paste the lines below into the file and save. Save the exit. Then create the required files and directories for the configurations above. Reload systemd-daemon to apply the configurations above. Start and enable the PowerDNS Admin service Then check its status. If everything is set up correctly, you should see similar results as below.
Access PowerDNS portal
Finally, open your browser and browse to the server hostname defined above. Create an account Login and register the API key used above when you see an API warning. That’s it! Conclusion: This post showed you how to install PowerDNS and PowerDNS Admin on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.