Install and Setup PowerDNS Admin on Ubuntu 22.04

Last Updated:

In this tutorial, you will learn how to easily install and setup PowerDNS Admin on Ubuntu 22.04. PowerDNS Admin is a web administrative interface for PowerDNS. It enables you to easily create and manage DNS zones from a web browser.

Features of PowerDNS Admin

PowerDNS Admin provides advanced features for managing PowerDNS. These include;

  • Multiple domain management
  • Domain template
  • User management
  • User access management based on domain
  • User activity logging
  • Support Local DB / SAML / LDAP / Active Directory user authentication
  • Support Google / Github / Azure / OpenID OAuth
  • Support Two-factor authentication (TOTP)
  • Dashboard and pdns service statistics
  • DynDNS 2 protocol support
  • Edit IPv6 PTRs using IPv6 addresses directly (no more editing of literal addresses!)
  • Limited API for manipulating zones and records

Installing PowerDNS Admin on Ubuntu 22.04

Install and Setup PowerDNS

To easily install and setup PowerDNS Admin, you need to have already install and setup PowerDNS nameserver using some relational database.

In our previous guide, we discussed how to configure PowerDNS nameserver with MariaDB on Ubuntu 22.04. Follow the link below to set it up.

Easily Install and Setup PowerDNS on Ubuntu 22.04

NOTE: We are installing PowerDNS Admin on the same server with PowerDNS already installed.

Install Required Package Dependencies

Install Python 3 library and development tools

apt install python3-dev

Install various required build tools and package dependencies.

apt install libsasl2-dev libldap2-dev libssl-dev \
libxml2-dev libxslt1-dev libxmlsec1-dev libffi-dev \
pkg-config apt-transport-https virtualenv build-essential \
libmariadb-dev git python3-flask libpq-dev -y

Install NodeJS

curl -sL | sudo -E bash - 
sudo apt install -y nodejs

Install Yarn

curl -sS | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/yarn.gpg
echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install yarn

Install Nginx HTTP Server

apt install nginx

Clone PowerDNS Admin Source Code to Web Root Directory

Clone PowerDNS Admin git source code to your Nginx web root directory. In this setup, we use, /var/www/html/pdns, as our PowerDNS Admin web root directory. It can be different for your case.

git clone /var/www/html/pdns

Create PowerDNS Admin Virtualenv

Navigate to the PowerDNS Admin web root directory and create a virtualenv.

cd /var/www/html/pdns/
virtualenv -p python3 flask

Next, active your Python 3 Virtual environment and install required Python 3 libraries

source ./flask/bin/activate
pip3 install --upgrade pip

Update the PyYAML version in the requirements.txt file. The current version, v5.4 gives this error;

Collecting PyYAML==5.4 (from -r requirements.txt (line 12))
  Using cached PyYAML-5.4.tar.gz (174 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [62 lines of output]
      /tmp/pip-build-env-un4ax31x/overlay/lib/python3.10/site-packages/setuptools/config/ _DeprecatedConfig: Deprecated config in `setup.cfg`
              The license_file parameter is deprecated, use license_files instead.
              By 2023-Oct-30, you need to update your project and remove deprecated calls
              or your builds will no longer be supported.
              See for details.

Thus, let’s downgrade the version from v5.4 to v5.3;

sed -i '/PyYAML/s/5.4/5.3.1/' requirements.txt

The install the requirements

pip3 install -r requirements.txt

Similarly, the textsize function is deprecated in Pillow 10. Thus Pillow 9.5.0 is required:

pip3 install Pillow==9.5.0

Configure PowerDNS Admin Database Connection

Exit the virtualenv and edit the default PowerDNS admin configuration file, $WEB_ROOT/powerdnsadmin/, to define the database connection details. Replace the $WEB_ROOT with the path to your web root directory.

vim /var/www/html/pdns/powerdnsadmin/

On the basic App configs, you can replace the SALT and SECRET_KEY keys, set the bind address and port;

SALT = 'xohDoozee8Zuneekooch9ohrieghei'
SECRET_KEY = 'hohru1aethaeyahpheH7Gaathaikah'
PORT = 9191

On the database configs, configure your PowerDNS database connection details. Note that we are using the details already created while setting up PowerDNS as defined in our guide.

SQLA_DB_USER = 'pdnsadmin'
SQLA_DB_NAME = 'kifarunixdemopdns'

Save and exit the configuration.

Next, reactivate the virtualenv run the DB migration;

cd /var/www/html/pdns/
source ./flask/bin/activate
export FLASK_APP=powerdnsadmin/
flask db upgrade

Once the command above completes, generate asset files with yarn;

yarn install --pure-lockfile
flask assets build

Exit the virtualenv;


Running PowerDNS Admin

PowerDNS Admin is now setup and ready. It can be run in standalone mode, by executing the in the web root directory.

In this setup, we will be using Nginx web server to access the PowerDNS Admin.

Enable PowerDNS API access

The PowerDNS Authoritative Server features a built-in webserver that exposes a JSON/REST API. This API allows for controlling several functions, reading statistics and modifying zone content, metadata and DNSSEC key material“.

Open PowerDNS configuration file and enable API and set the API Key;

vim /etc/powerdns/pdns.conf

# api   Enable/disable the REST API (including HTTP listener)
# api=no

# api-key       Static pre-shared authentication key for access to the REST API
# api-key=

Save and exit the file and restart PowerDNS;

systemctl restart pdns

Create PowerDNS Admin Nginx Site

Create PowerDNS Admin Nginx site with the contents below. Replace web root directory accordingly.

vim /etc/nginx/conf.d/pdns-admin.conf

server {
  listen	*:80;
  server_name     ;

  index                     index.html index.htm index.php;
  root                      /var/www/html/pdns;
  access_log                /var/log/nginx/pdnsadmin_access.log combined;
  error_log                 /var/log/nginx/pdnsadmin_error.log;

  client_max_body_size              10m;
  client_body_buffer_size           128k;
  proxy_redirect                    off;
  proxy_connect_timeout             90;
  proxy_send_timeout                90;
  proxy_read_timeout                90;
  proxy_buffers                     32 4k;
  proxy_buffer_size                 8k;
  proxy_set_header                  Host $host;
  proxy_set_header                  X-Real-IP $remote_addr;
  proxy_set_header                  X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_headers_hash_bucket_size    64;

  location ~ ^/static/  {
    include  /etc/nginx/mime.types;
    root /var/www/html/pdns/powerdnsadmin;

    location ~*  \.(jpg|jpeg|png|gif)$ {
      expires 365d;

    location ~* ^.+.(css|js)$ {
      expires 7d;

  location / {
    proxy_pass            http://unix:/run/pdnsadmin/socket;
    proxy_read_timeout    120;
    proxy_connect_timeout 120;
    proxy_redirect        off;


Save and exit the file.

Remove the default Nginx default site and run config syntax check.

mv /etc/nginx/sites-enabled/default{,.old}
nginx -t

Sample syntax check output.

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Update ownership of the PDNS Admin root directory

chown -R www-data: /var/www/html/pdns

Restart Nginx;

systemctl restart nginx

Create PowerDNS Admin Systemd Service Unit

To be able to run PowerDNS Admin as a systemd service, create a unit file as shown below;

cat > /etc/systemd/system/pdnsadmin.service << 'EOL'           

ExecStart=/var/www/html/pdns/flask/bin/gunicorn --pid /run/pdnsadmin/pid --bind unix:/run/pdnsadmin/socket 'powerdnsadmin:create_app()'
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID


cat > /etc/systemd/system/pdnsadmin.socket << 'EOL'
Description=PowerDNS-Admin socket


echo "d /run/pdnsadmin 0755 pdns pdns -" >> /etc/tmpfiles.d/pdnsadmin.conf
mkdir /run/pdnsadmin/
chown -R pdns: /run/pdnsadmin/
chown -R pdns: /var/www/html/pdns/powerdnsadmin/

Reload System Configurations and start and enable PowerDNS Admin service to run on system boot;

systemctl enable --now pdnsadmin.service pdnsadmin.socket

Check the status;

systemctl status pdnsadmin.service pdnsadmin.socket

● pdnsadmin.service - PowerDNS-Admin
     Loaded: loaded (/etc/systemd/system/pdnsadmin.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-07-28 18:59:39 UTC; 6s ago
TriggeredBy: ● pdnsadmin.socket
   Main PID: 37722 (gunicorn)
      Tasks: 2 (limit: 2219)
     Memory: 88.6M
        CPU: 952ms
     CGroup: /system.slice/pdnsadmin.service
             ├─37722 /var/www/html/pdns/flask/bin/python /var/www/html/pdns/flask/bin/gunicorn --pid /run/pdnsadmin/pid --bind unix:/run/pdnsadmin/socket "powerdnsadmin:cr>
             └─37723 /var/www/html/pdns/flask/bin/python /var/www/html/pdns/flask/bin/gunicorn --pid /run/pdnsadmin/pid --bind unix:/run/pdnsadmin/socket "powerdnsadmin:cr>

Jul 28 18:59:39 jammy systemd[1]: Started PowerDNS-Admin.
Jul 28 18:59:39 jammy gunicorn[37722]: [2023-07-28 18:59:39 +0000] [37722] [INFO] Starting gunicorn 20.1.0
Jul 28 18:59:39 jammy gunicorn[37722]: [2023-07-28 18:59:39 +0000] [37722] [INFO] Listening at: unix:/run/pdnsadmin/socket (37722)
Jul 28 18:59:39 jammy gunicorn[37722]: [2023-07-28 18:59:39 +0000] [37722] [INFO] Using worker: sync
Jul 28 18:59:39 jammy gunicorn[37723]: [2023-07-28 18:59:39 +0000] [37723] [INFO] Booting worker with pid: 37723

● pdnsadmin.socket - PowerDNS-Admin socket
     Loaded: loaded (/etc/systemd/system/pdnsadmin.socket; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2023-07-28 18:59:39 UTC; 6s ago
   Triggers: ● pdnsadmin.service
     Listen: /run/pdnsadmin/socket (Stream)
     CGroup: /system.slice/pdnsadmin.socket

Jul 28 18:59:39 jammy systemd[1]: Listening on PowerDNS-Admin socket.

Accessing PowerDNS Admin Web Interface

Open Nginx on firewall to allow external access;

ufw allow "Nginx Full"

As per our configuration above, you can access PowerDNS Admin web interface via the address http://server-hostname. You should be able to see the PowerDNS Admin login screen. (if not, check status of the PowerDNS admin service or Nginx error logs for a hint).

pdns admin login

Create PowerDNS Admin administrative user account

Click Create an account to create the very first PowerDNS Admin admin user. Enter the user details.

PowerDNS Admin create user account

Click Register to create an account.

After that, login using the user details you provided. Upon successful login, you should land on PowerDNS Admin interface.

pdns web ui

For PowerDNS Admin to be able to connect to PowerDNS and manage it, you need to provide;

  • the API Key URL, usually, by default,
  • the API Key you defined in the PowerDNS configuration file.
  • Exact version of your PowerDNS (get the version using the command, pdns_control version).
Install and Setup PowerDNS Admin on Ubuntu 22.04

Click Save Settings and the error should just disappear.

Click on the Dashboard to go to PowerDNS Admin dashboard and you should be able to see your zones.

Forward Zone and Records;

powerdns zones

As you can see, we already added the DNS records in our previous guide. If you click on the domain name, you should the records we already added;

powerdns forward zones records

That is the forward zone records.

Reverse Zones;

If you click on the reverse zone under the Dashboard > Zones in-addr, you should see the reverse zone records.

reverse zone

Reverse zone Records;

reverse zone records

And that marks the end of our tutorial on how to easily install PowerDNS Admin on Ubuntu 22.04.


Running PowerDNS Admin on Ubuntu or Debian

Configure BIND DNS Server using Webmin on CentOS 8

Setup Bind DNS Using Webmin on Debian 10


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment