Skip to content
Follow
CMS Ubuntu Linux

How to Install PowerDNS on Ubuntu Linux

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

You install PowerDNS on Ubuntu Linux by following a straightforward command-line process to set up a powerful, open-source authoritative DNS server.

PowerDNS is a highly regarded DNS server known for its speed and adaptability, often integrating with databases for configuration management.

This tutorial guides you through installing PowerDNS Authoritative Server, specifically version 4.9, on a modern Ubuntu LTS system.

By the end, you’ll have a secure and efficient DNS infrastructure ready to manage your domain 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?

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

Install the MariaDB database server

We’ll start by installing MariaDB, a database that securely stores all your DNS records for PowerDNS.

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

sudo mysql

Run these commands to create your database and user:

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

Now it’s time to install PowerDNS on your Ubuntu system, which will handle your DNS requests.

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

Now, let’s move on to installing PowerDNS. First, we need to handle the system resolver.

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

Edit the configuration file to connect it to your database. You’ll need to add your database details here:

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

Next, we’ll install the PowerDNS Admin web application to make managing your PowerDNS settings simple.

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

We need to set up the PowerDNS Admin application to run smoothly in the background as a 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. With this feature-rich web application, you will be managing your DNS environment in no time flat.

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

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 Change Default Distro in Windows Subsystem for Linux
Windows How to Change Default Distro in Windows Subsystem for Linux
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04

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

Leave a Comment

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