Skip to content
Follow
CMS Ubuntu Linux

How to Install PowerDNS on Ubuntu Linux

Richard
Written by
Richard
Oct 7, 2022 Updated Jul 14, 2026 3 min read
Enable Automatic Suspension in Ubuntu Linux Easily
Enable Automatic Suspension in Ubuntu Linux Easily

PowerDNS is an open-source, authoritative DNS server you can install on Ubuntu Linux.

This type of server handles requests about which IP addresses belong to your website names, like PowerDNS.org.

This guide shows you how to install PowerDNS Authoritative Server, specifically version 4.9, on a recent Ubuntu LTS system. You will set up a fast and flexible DNS server for your own needs.

⚡ Quick Answer

Install PowerDNS on Ubuntu by updating system resolvers, then installing the `pdns-server` and `pdns-backend-mysql` packages. Configure PowerDNS to connect to a MariaDB database, and then install the PowerDNS Admin web application.

Why use PowerDNS?

PowerDNS gives you complete control over your DNS infrastructure. This system offers a scalable solution for managing thousands of records, complete with a modern web interface. Once finished, you will have a professional DNS management system accessible right from your browser.

Install the MariaDB database server

First, install MariaDB to securely store all your DNS records for PowerDNS. This database setup is crucial before you can configure PowerDNS to manage your domain information.

Once MariaDB is installed, open your terminal and connect to the database:

sudo mysql

Run these commands to create your database and user:

⚠️Warning
CREATE DATABASE pdns;
CREATE USER 'pdnsadmin'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON pdns.* TO 'pdnsadmin'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Install PowerDNS

This section explains how to install PowerDNS on your Ubuntu system, the software that will handle all your DNS requests. We'll also cover updating your system's DNS resolver settings to point to a reliable DNS server like Google's.

⚠️Warning
sudo resolvectl dns eth0 8.8.8.8
sudo sed -i 's/#DNS=/DNS=8.8.8.8/' /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved

PowerDNS installation begins with configuring the system resolver. This step ensures that your Ubuntu system correctly identifies and uses PowerDNS for domain name resolution, preventing connectivity issues.

sudo apt update
sudo apt install pdns-server pdns-backend-mysql

Import the database structure:

sudo mysql -u pdnsadmin -p pdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql

Configure PowerDNS

The PowerDNS configuration file requires database details for connection. You must add your database credentials within this file to ensure PowerDNS can access its data storage.

sudo nano /etc/powerdns/pdns.d/pdns.local.gmysql.conf

launch+=gmysql
gmysql-host=127.0.0.1
gmysql-user=pdnsadmin
gmysql-password=your_secure_password
gmysql-dbname=pdns

Install the PowerDNS Admin web application

The PowerDNS Admin web application easily manages your PowerDNS settings. To install this application, you must first install Python and Nginx. Then, set up the PowerDNS Admin folder and the application's virtual environment (a self-contained Python setup).

sudo apt install python3-venv python3-pip gunicorn nginx certbot python3-certbot-nginx

Set up the application folder and virtual environment:

sudo git clone https://github.com/ngoduykhanh/PowerDNS-Admin.git /var/www/html/pdns
cd /var/www/html/pdns
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Run database migrations to prepare the app:

export FLASK_APP=powerdnsadmin/__init__.py
flask db upgrade

Configure PowerDNS and Nginx

Enable the API in /etc/powerdns/pdns.conf by adding:

api=yes
api-key=generate_a_very_long_random_string_here

Restart PowerDNS: sudo systemctl restart pdns

Configure Nginx to serve the site and secure it with HTTPS:

sudo certbot --nginx -d yourdomain.com

PowerDNS Admin interface on Ubuntu Linux
ubuntu linux powerdns admin

Start the Service

PowerDNS Admin starts the PowerDNS Admin application, ensuring the PowerDNS Admin software runs smoothly in the background as a service. This action reloads the system's service manager, then turns on and starts the PowerDNS Admin service.

sudo systemctl daemon-reload
sudo systemctl enable --now pdnsadmin

Creating a PowerDNS user account on Ubuntu
ubuntu linux powerdns create account

Open your browser to your domain name, log in, and enter the API key you generated earlier to finish the setup.

[Unit] [Service] [Install] [Unit] [Socket] [Install] [1] [10066] [2022-10-07 12:55:24 -0500] [10066] [INFO] [10066] [2022-10-07 12:55:24 -0500] [10066] [INFO] [10066] [2022-10-07 12:55:24 -0500] [10066] [INFO] [10067] [2022-10-07 12:55:24 -0500] [10067] [INFO] [1]

Where is the PowerDNS config file?

Location of pdns. conf. Default is /etc/powerdns.

Does PowerDNS have a GUI?

Poweradmin is an open source, friendly, and easy-to-use web GUI for PowerDNS that supports key features. This feature-rich web application will have you managing your DNS environment quickly.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

Install MySQL and MariaDB on Ubuntu: A Step-by-Step Guide
Ubuntu Linux Install MySQL and MariaDB on Ubuntu: A Step-by-Step Guide
How to Install Let's Chat on Ubuntu Linux
Ubuntu Linux How to Install Let's Chat on Ubuntu Linux
Change Power Button Behavior in Ubuntu Linux
Ubuntu Linux Change Power Button Behavior in Ubuntu Linux
How to Install Python Pip on Ubuntu Linux
Ubuntu Linux How to Install Python Pip on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *