Skip to content
Follow
CMS Ubuntu Linux

How to Install PowerDNS on Ubuntu Linux

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

PowerDNS is a free, open-source DNS server that translates website names into IP addresses so your computer can find websites online. Version 4.9 of the PowerDNS Authoritative Server runs on Ubuntu LTS systems to handle these name lookup requests quickly and reliably.

Setting up this software gives you total control over your own domain name records without paying a third party. You just need a basic Ubuntu server and root access to get started.

⚡ 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 administrators complete control over DNS infrastructure. This system offers a scalable solution for managing thousands of records, complete with a modern web interface. Finishing these steps leaves behind a professional DNS management system accessible right from a browser.

Install the MariaDB database server

First, install MariaDB to securely store all DNS records for PowerDNS. This database setup remains crucial before configuring PowerDNS to manage domain information.

Once MariaDB finishes installing , open the terminal and connect to the database:

sudo mysql

Run these commands to create the 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 the Ubuntu system, providing the software that handles all DNS requests. System DNS resolver settings also get updated to point toward a reliable 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

Configuring the system resolver starts the installation. This step ensures Ubuntu 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. Adding database credentials within this file ensures PowerDNS accesses its data storage properly.

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 manages PowerDNS settings. Installing this application requires Python and Nginx first. Next, create the PowerDNS Admin folder and set up a virtual environment (a self-contained directory for Python packages).

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

Systemd starts the PowerDNS Admin application, ensuring the 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 a browser to the domain name, log in, and enter the API key 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 accessible web GUI for PowerDNS that supports key features. This feature-rich web application helps administrators manage DNS environments 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 on Ubuntu Linux
Ubuntu Linux How to Install Python 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 *