How to Install PowerDNS and PowerDNS-Admin on Debian 13 (Trixie): Set Up Your Own Nameserver
Hosting your own DNS infrastructure gives you full control over your domains, improves privacy, and allows for advanced automation. In this guide, we will walk through how to install PowerDNS (an authoritative DNS server) and PowerDNS-Admin (a powerful web-based GUI) on a fresh Debian 13 (Trixie) server.
Prerequisites
Step 1: Install and Configure MariaDB
PowerDNS requires a database backend to store DNS zones and records. We will use MariaDB, which is the default MySQL provider in Debian 13.
Secure your database installation and create the PowerDNS database and user:
Note: We use '%' instead of 'localhost' so the Docker container in Step 4 can connect to the database.
Now, open the MariaDB configuration file to allow connections from Docker:
Find the line bind-address = 127.0.0.1 and change it to:
Restart MariaDB to apply changes:
Step 2: Install PowerDNS Authoritative Server
Before installing PowerDNS, we must disable Debian's built-in stub resolver (systemd-resolved), as it occupies port 53 by default. If we don't do this, PowerDNS will fail to start.
Now, install the PowerDNS server along with the MariaDB/MySQL backend plugin:
Next, import the official PowerDNS database schema into your newly created database:
Step 3: Configure PowerDNS to use the Database and API
Open the main configuration file:
Update or add the following lines to connect PowerDNS to your database and enable the API (which PowerDNS-Admin requires to communicate with the server):
Restart and enable the PowerDNS service to apply the changes:
Step 4: Install PowerDNS-Admin via Docker Compose
The easiest and cleanest way to run PowerDNS-Admin on Debian 13 is using Docker. Install Docker and the modern compose plugin:
Create a dedicated directory for your admin panel and create a docker-compose.yml file:
Paste the following configuration into the file. Make sure to replace your_secure_password with your actual database password and YOUR_SERVER_IP with your server's public IP address:
Launch the PowerDNS-Admin container in the background:
Step 5: Final Web Interface Setup
Open your web browser and navigate to your server's IP address (e.g., http://your-server-ip).
Your self-hosted nameserver on Debian 13 is now fully operational! You can now start creating DNS zones, adding records (A, AAAA, MX, TXT), and pointing your domain registrars to your new custom nameserver.
--------------------------------------------------
If you run into any issues during the installation or need help configuring firewalls, let me know in the comments below!
Hosting your own DNS infrastructure gives you full control over your domains, improves privacy, and allows for advanced automation. In this guide, we will walk through how to install PowerDNS (an authoritative DNS server) and PowerDNS-Admin (a powerful web-based GUI) on a fresh Debian 13 (Trixie) server.
Prerequisites
- A server running Debian 13
- Root or sudo access to the server
- A public IP address with ports 53 UDP/TCP and 80/443 open
- Docker installed (recommended for running PowerDNS-Admin securely)
Step 1: Install and Configure MariaDB
PowerDNS requires a database backend to store DNS zones and records. We will use MariaDB, which is the default MySQL provider in Debian 13.
Code:
sudo apt update && sudo apt upgrade -y sudo apt install mariadb-server -y
Code:
sudo mariadb-secure_installation # Log into MariaDB sudo mariadb -u root -p # Run these SQL commands: CREATE DATABASE powerdns; GRANT ALL PRIVILEGES ON powerdns.* TO 'pdns_user'@'%' IDENTIFIED BY 'your_secure_password'; FLUSH PRIVILEGES; EXIT;
Now, open the MariaDB configuration file to allow connections from Docker:
Code:
sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf
Code:
bind-address = 0.0.0.0
Code:
sudo systemctl restart mariadb
Before installing PowerDNS, we must disable Debian's built-in stub resolver (systemd-resolved), as it occupies port 53 by default. If we don't do this, PowerDNS will fail to start.
Code:
sudo systemctl disable --now systemd-resolved sudo rm /etc/resolv.conf echo "nameserver 1.1.1.1" | sudo tee /etc/resolv.conf
Code:
sudo apt install pdns-server pdns-backend-mysql -y
Code:
sudo mariadb -u pdns_user -p powerdns < /usr/share/doc/pdns-backend-mysql/schema.mysql.sql
Open the main configuration file:
Code:
sudo nano /etc/powerdns/pdns.conf
Code:
launch=gmysql gmysql-host=127.0.0.1 gmysql-user=pdns_user gmysql-password=your_secure_password gmysql-dbname=powerdns # Enable Webserver and API api=yes api-key=your_secret_api_key webserver=yes webserver-address=0.0.0.0 webserver-port=8081
Code:
sudo systemctl restart pdns sudo systemctl enable pdns
The easiest and cleanest way to run PowerDNS-Admin on Debian 13 is using Docker. Install Docker and the modern compose plugin:
Code:
sudo apt install docker.io docker-compose-v2 -y
Code:
mkdir pdns-admin && cd pdns-admin nano docker-compose.yml
Code:
version: '3'
services:
pdns-admin:
image: powerdnsadmin/pda-legacy:latest
container_name: pdns-admin
ports:
- "80:80"
environment:
- SQLALCHEMY_DATABASE_URI=mysql+pymysql://pdns_user:your_secure_password@YOUR_SERVER_IP/powerdns
- SECRET_KEY=another_random_secret_key
logging:
driver: json-file
options:
max-size: "50m"
restart: always
Code:
sudo docker compose up -d
Open your web browser and navigate to your server's IP address (e.g., http://your-server-ip).
- Create your administrator account on the initial setup page.
- Log in and go to Settings -> PDNS in the menu.
- Set the PowerDNS API URL to http://172.17.0.1:8081 and enter the api-key you generated in Step 3.
- Click save to connect the interface to your DNS server.
Your self-hosted nameserver on Debian 13 is now fully operational! You can now start creating DNS zones, adding records (A, AAAA, MX, TXT), and pointing your domain registrars to your new custom nameserver.
--------------------------------------------------
If you run into any issues during the installation or need help configuring firewalls, let me know in the comments below!