How to Install PowerDNS and Poweradmin on Ubuntu 24.04 (MySQL Backend)
Set up an authoritative PowerDNS server with a MySQL backend and the Poweradmin web GUI on Ubuntu 24.04. Tested step by step, including the port 53 conflict, the REFUSED answers for new zones, and the old schema errors.
Originally published in May 2015 for CentOS 6. Reviewed and updated in December 2026 for Ubuntu 24.04, PowerDNS 4.8 and Poweradmin 4.4, with the old "PowerDNS webinterface" guide merged in. I ran every step below on Ubuntu 24.04.
PowerDNS Authoritative Server answers DNS queries for your own domains and reads the zones from a database. Poweradmin is a PHP web interface that edits that database, so you can manage zones and records in a browser instead of with SQL.
What you'll end up with:
- PowerDNS Authoritative 4.8 from the Ubuntu repositories, with zones stored in MySQL or MariaDB
- Poweradmin 4.4 on Apache and PHP 8.3
- a test zone that answers with
dig
This is an authoritative server for your own zones, not a resolver for your network. If you want a caching DNS server for your clients, that's the PowerDNS Recursor or something like Unbound, a different project.
Versions
Ubuntu 24.04 ships PowerDNS 4.8.3. The PowerDNS project itself is already on the 5.x series, with packages for Ubuntu at repo.powerdns.com. For a small setup the Ubuntu package is fine and gets security updates from Ubuntu. I used it for this guide.
Poweradmin 4.4.x is the current stable line. It needs PHP 8.2 or newer, so Ubuntu 24.04 with PHP 8.3 works out of the box. On Ubuntu 22.04 (PHP 8.1) you'd need a newer PHP first.
1. Free up port 53
On Ubuntu, systemd-resolved already listens on 127.0.0.53:53. PowerDNS by default binds to all addresses on port 53, and that fails:
Unable to bind UDP socket to '0.0.0.0:53': Address already in use
Fatal error: Unable to bind to UDP socket
I got exactly that when something was holding 127.0.0.53:53. You have two options:
- Bind PowerDNS to the server's own IP (keeps
systemd-resolvedworking for the server itself). Add to the config in step 4:
local-address=192.0.2.2
With that, PowerDNS started and answered on the server IP in my test.
- Turn off the resolved stub listener: set
DNSStubListener=noin/etc/systemd/resolved.confand restartsystemd-resolved. Then PowerDNS can bind to0.0.0.0.
Check what's using the port with sudo ss -lunp | grep ':53 '.
2. Install PowerDNS and MySQL
sudo apt update
sudo apt install pdns-server pdns-backend-mysql mysql-server
MariaDB works the same way (mariadb-server).
3. Create the database
sudo mysql -e "CREATE DATABASE powerdns;"
sudo mysql -e "CREATE USER 'pdns'@'localhost' IDENTIFIED BY 'change-this-password';"
sudo mysql -e "GRANT ALL PRIVILEGES ON powerdns.* TO 'pdns'@'localhost';"
sudo mysql powerdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql
Use the schema file that comes with the package, not a CREATE TABLE block copied from an old guide. The original version of this article had one, and two things go wrong with it today:
- On MySQL 8 it doesn't even create:
ERROR 1074 (42000): Column length too big for column 'content' (max = 16383); use BLOB or TEXT instead. The current schema avoids that by usinglatin1for those tables. - If you get it created anyway (with
latin1), PowerDNS 4.8 fails on it withUnknown column 'options' in 'field list', because newer versions need theoptionsandcatalogcolumns.
If you're upgrading an old server, the package has migration scripts in /usr/share/pdns-backend-mysql/schema/. In my test, 4.3.0_to_4.7.0_schema.mysql.sql fixed the old database:
sudo mysql powerdns < /usr/share/pdns-backend-mysql/schema/4.3.0_to_4.7.0_schema.mysql.sql
Back up the database before running a migration. For more on MySQL users and remote access, see connecting to a remote MySQL database.
4. Configure the MySQL backend
Ubuntu's package starts with a BIND-file backend, configured in /etc/powerdns/pdns.d/bind.conf. Move it out of the way, or PowerDNS uses both:
sudo mv /etc/powerdns/pdns.d/bind.conf /root/pdns-bind.conf.disabled
Create /etc/powerdns/pdns.d/gmysql.conf:
launch+=gmysql
gmysql-host=127.0.0.1
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=pdns
gmysql-password=change-this-password
gmysql-dnssec=yes
# new zones answer immediately (see "REFUSED for new zones" below)
zone-cache-refresh-interval=0
Add local-address=... here too if you chose that in step 1. The file contains a password, so lock it down:
sudo chown root:pdns /etc/powerdns/pdns.d/gmysql.conf
sudo chmod 640 /etc/powerdns/pdns.d/gmysql.conf
sudo systemctl restart pdns
sudo systemctl status pdns
Settings are described in the generic MySQL backend docs.
5. Create a zone and test it
pdnsutil writes straight into the database:
sudo pdnsutil create-zone example.com ns1.example.com
sudo pdnsutil add-record example.com @ A 3600 192.0.2.10
sudo pdnsutil add-record example.com www CNAME 3600 example.com.
sudo pdnsutil add-record example.com ns1 A 3600 192.0.2.53
sudo pdnsutil add-record example.com @ MX 3600 "10 mail.example.com."
sudo pdnsutil check-zone example.com
Checked 6 records of 'example.com', 0 errors, 0 warnings.
Fix the SOA. create-zone makes one with a placeholder name server and serial 0: a.misconfigured.dns.server.invalid hostmaster.example.com 0 .... Replace it with your own:
sudo pdnsutil replace-rrset example.com @ SOA 3600 \
"ns1.example.com. hostmaster.example.com. 2026120401 10800 3600 604800 3600"
After later changes, bump the serial with sudo pdnsutil increase-serial example.com, so secondary servers pick them up. Or set default-soa-content in the config once, so new zones get a proper SOA from the start.
Query it:
dig @127.0.0.1 example.com A
dig +short @127.0.0.1 www.example.com
You should get status: NOERROR and 192.0.2.10, with the aa (authoritative answer) flag. A query for a domain you don't host, like google.com, gets REFUSED. That's correct for an authoritative-only server.
REFUSED for a zone you just created
This one cost me some time. Right after creating example.com, dig returned status: REFUSED, although pdnsutil check-zone was clean and the zone was in the database. Two things are happening:
- Zone cache. The running server keeps a list of zones in memory and only refreshes it every 300 seconds by default (
zone-cache-refresh-interval). Zones added bypdnsutilor Poweradmin go straight into the database, so the server doesn't know about them yet and refuses. - Packet cache. That
REFUSEDanswer is then cached for about 20 seconds (cache-ttl), so even after the zone cache updates, you get the old answer for a bit.
Ways to fix it:
# tell the running server to reload its zone list
sudo pdns_control rediscover
# and drop a cached REFUSED answer for this zone
sudo pdns_control purge 'example.com$'
Or set zone-cache-refresh-interval=0 as in the config above. That turns the zone cache off, and in my test zones added with pdnsutil and with Poweradmin answered right away. For a small server it's the simplest choice. On a server with a huge number of zones, keep the cache and accept the short delay.
6. Install Poweradmin
Install Apache and the PHP modules Poweradmin checks for:
sudo apt install apache2 libapache2-mod-php php-mysql php-intl php-xml
sudo a2enmod rewrite
Get the latest 4.4.x release from the Poweradmin releases page. I used git with the release tag, since the repository already includes the PHP dependencies:
cd /tmp
git clone --depth 1 --branch v4.4.3 https://github.com/poweradmin/poweradmin.git
sudo cp -r poweradmin /var/www/poweradmin
sudo chown -R www-data:www-data /var/www/poweradmin
Poweradmin 4.1 and later need URL rewriting, which comes from its .htaccess file. So the Apache site must allow overrides. Create /etc/apache2/sites-available/poweradmin.conf:
<VirtualHost *:80>
ServerName dns.example.com
DocumentRoot /var/www/poweradmin
<Directory /var/www/poweradmin>
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
sudo a2ensite poweradmin
sudo a2dissite 000-default
sudo systemctl reload apache2
Run the installer
Open http://dns.example.com/install/. It has 8 steps:
- Language.
- Requirements check. It checks PHP, the extensions (intl, gettext, openssl, filter, tokenizer, pdo, xml), the database driver and mod_rewrite. Everything should say OK.
- Getting ready.
- Database. Choose the SQL backend, and enter the
pdnsuser from step 3, which can create tables. Set the password for the Poweradminadminaccount here too. The installer then creates Poweradmin's own tables (users, permissions, logs, templates) in the samepowerdnsdatabase. - Account and name servers. A database user for Poweradmin's daily work, plus your hostmaster address and name servers for new zones.
- Limited-rights user. The installer shows SQL to run yourself:
CREATE USER 'poweradmin'@'127.0.0.1' IDENTIFIED BY 'another-password';
GRANT SELECT, INSERT, UPDATE, DELETE ON powerdns.* TO 'poweradmin'@'127.0.0.1';
Use 127.0.0.1 as the host if you connect over TCP, as in my config. The installer also shows an '@'%' variant, but don't use that unless Poweradmin runs on another machine.
- Configuration file. The installer doesn't write it for you. Copy the content it shows into
/var/www/poweradmin/config/settings.php, then:
sudo chown www-data:www-data /var/www/poweradmin/config/settings.php
sudo chmod 640 /var/www/poweradmin/config/settings.php
- Done. Remove the installer:
sudo rm -rf /var/www/poweradmin/install
Poweradmin enforces this one: until the folder is gone, the login page shows The install/ directory exists, you must remove it first before proceeding.
Log in as admin with the password from step 4. Add a zone under Add master zone, and PowerDNS serves it (right away if you set zone-cache-refresh-interval=0).
Secure it
- PHP updates matter. Poweradmin is a PHP app, so a PHP security hole is a hole in your DNS admin panel. In 2026, the php2shell vulnerabilities in PHP 8 allowed remote code execution and were exploited in the wild. Check your server with the php2shell check and fix guide, and keep
apt upgraderunning. - Don't put Poweradmin on the open internet over plain HTTP. Use HTTPS, and ideally restrict it to your VPN or office IP in the Apache config.
- Open only port 53 (UDP and TCP) to the world, and keep MySQL bound to localhost. Firewall basics: iptables on Ubuntu 24.04.
- Use two name servers. Registrars expect at least two NS records for a domain. Set up a second PowerDNS as a secondary or use a secondary DNS service.
The old CentOS guides
The 2015 versions of this guide and the merged "powerdns-webinterface" post used CentOS 6, EPEL 6, /etc/init.d scripts, Poweradmin 2.1.7 and a web interface hosted on Google Code. All of that is gone: CentOS 6 is long dead, Google Code shut down, and Poweradmin 2.x doesn't run on PHP 8. On Rocky or AlmaLinux the same approach works with the pdns and pdns-backend-mysql packages from EPEL. See installing EPEL. I didn't test that path for this update.
FAQ
What is Poweradmin?
A free web interface for PowerDNS. It manages zones, records, users and permissions by writing to the PowerDNS database, so you don't have to edit records with SQL or pdnsutil.
Why does PowerDNS return REFUSED for my new zone?
The server hasn't picked up the new zone yet. Run sudo pdns_control rediscover, or set zone-cache-refresh-interval=0. If you already queried it, sudo pdns_control purge 'example.com$' drops the cached REFUSED answer.
PowerDNS says "Unable to bind UDP socket to 0.0.0.0:53: Address already in use". What now?
systemd-resolved is using port 53 on 127.0.0.53. Set local-address to your server IP in the PowerDNS config, or disable the resolved stub listener with DNSStubListener=no.
Which PowerDNS version does Ubuntu 24.04 have?
4.8.3 in the Ubuntu repositories. Newer 5.x versions are available from the PowerDNS repository at repo.powerdns.com.
Can I use the database schema from an old guide?
No. Use /usr/share/pdns-backend-mysql/schema/schema.mysql.sql from the package. The old schema fails on MySQL 8 and lacks columns that PowerDNS 4.7 and later need.
Do I need Poweradmin to run PowerDNS?
No. pdnsutil does everything from the command line. Poweradmin is useful when several people manage zones, or when you prefer a browser.