PowerDNS consists of three main components: the Authoritative Server, the Recursor, and DNSdist. This guide covers installation of the Authoritative Server, though similar methods apply to other components.
PowerDNS provides official repositories for all major Linux distributions with up-to-date packages.
To ensure packages from the PowerDNS repository are preferred over distribution packages, create a pinning configuration:
# Create APT preferences file
echo -e "Package: pdns-*\nPin: origin repo.powerdns.com\nPin-Priority: 600" | sudo tee /etc/apt/preferences.d/pdns
Add the official PowerDNS repository for the latest stable version:
# Create keyrings directory
sudo install -d /etc/apt/keyrings
# Import the GPG key (Key ID: 0xFD380FBB)
curl -fsSL https://repo.powerdns.com/FD380FBB-pub.asc | sudo tee /etc/apt/keyrings/pdns-archive-keyring.gpg > /dev/null
# Add the repository (for Ubuntu 22.04+/Jammy or Debian 12+/Bookworm)
# For Ubuntu 22.04 (Jammy):
echo "deb [signed-by=/etc/apt/keyrings/pdns-archive-keyring.gpg] https://repo.powerdns.com/ubuntu jammy-auth-50 main" | sudo tee /etc/apt/sources.list.d/pdns.list
# For Ubuntu 24.04 (Noble):
# echo "deb [signed-by=/etc/apt/keyrings/pdns-archive-keyring.gpg] https://repo.powerdns.com/ubuntu noble-auth-50 main" | sudo tee /etc/apt/sources.list.d/pdns.list
# For Debian 12 (Bookworm):
# echo "deb [signed-by=/etc/apt/keyrings/pdns-archive-keyring.gpg] https://repo.powerdns.com/debian bookworm-auth-50 main" | sudo tee /etc/apt/sources.list.d/pdns.list
# Update package list
sudo apt update
# Install PowerDNS Authoritative Server with MySQL backend
sudo apt install pdns-server pdns-backend-mysql
# Or install with PostgreSQL backend
sudo apt install pdns-server pdns-backend-pgsql
# Or install with SQLite backend
sudo apt install pdns-server pdns-backend-sqlite3
# Install EPEL release
sudo dnf install epel-release
# Add PowerDNS repository (for Enterprise Linux 9)
curl -fsSL https://repo.powerdns.com/repo-files/el-auth-50.repo | sudo tee /etc/yum.repos.d/powerdns-auth-50.repo
# Install PowerDNS Authoritative Server
sudo dnf install pdns pdns-backend-mysql
# Or with PostgreSQL
sudo dnf install pdns pdns-backend-pgsql
# Or with SQLite
sudo dnf install pdns pdns-backend-sqlite3
# Update package index
sudo apk update
# Install PowerDNS Authoritative Server (with SQLite backend included)
sudo apk add pdns
# Note: Alpine package may not have separate backend packages
# For MySQL/PostgreSQL backends, install the appropriate client libraries
sudo apk add pdns-backend-mysql
# or
sudo apk add pdns-backend-pgsql
Note: Alpine Linux package availability may vary. Verify package names with
apk search pdnsbefore installation.
# Create database and user
mysql -u root -p
CREATE DATABASE pdns;
GRANT ALL ON pdns.* TO 'pdns'@'localhost' IDENTIFIED BY 'your_secure_password';
FLUSH PRIVILEGES;
EXIT;
# Import schema (path varies by distribution)
# Debian/Ubuntu:
mysql -u pdns -p pdns < /usr/share/pdns-backend-mysql/schema.mysql.sql
# RHEL/CentOS/AlmaLinux/Rocky:
mysql -u pdns -p pdns < /usr/share/doc/pdns/schema.mysql.sql
# Alternative: Download schema from GitHub
curl -fsSL https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gmysqlbackend/schema.mysql.sql | mysql -u pdns -p pdns
# Create database and user
sudo -u postgres psql
CREATE USER pdns WITH PASSWORD 'your_secure_password';
CREATE DATABASE pdns OWNER pdns;
\q
# Import schema (path varies by distribution)
# Debian/Ubuntu:
sudo -u postgres psql pdns < /usr/share/pdns-backend-pgsql/schema.pgsql.sql
# RHEL/CentOS/AlmaLinux/Rocky:
sudo -u postgres psql pdns < /usr/share/doc/pdns/schema.pgsql.sql
# Alternative: Download schema from GitHub
curl -fsSL https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gpgsqlbackend/schema.pgsql.sql | sudo -u postgres psql pdns
Edit the main configuration file:
sudo nano /etc/powerdns/pdns.conf
Essential configuration options:
# Listen on all interfaces on port 53
local-address=0.0.0.0,::
local-port=53
# Launch the appropriate backend
launch=gmysql # for MySQL
# OR
# launch=gpgsql # for PostgreSQL
# OR
# launch=gsqlite3 # for SQLite
# MySQL backend settings (adjust as needed)
gmysql-host=localhost
gmysql-user=pdns
gmysql-password=your_secure_password
gmysql-dbname=pdns
gmysql-socket=/var/run/mysqld/mysqld.sock
# PostgreSQL backend settings (adjust as needed)
gpgsql-host=localhost
gpgsql-user=pdns
gpgsql-password=your_secure_password
gpgsql-dbname=pdns
gpgsql-port=5432
# SQLite backend settings
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3
# Enable DNSSEC (recommended)
enable-dnssec=yes
# Logging
loglevel=6
logging-facility=0
# Web server for API and statistics (optional)
webserver=yes
webserver-address=127.0.0.1
webserver-port=8081
webserver-password=your_webserver_password
api=yes
api-key=your_api_key_here
# Reload systemd daemon
sudo systemctl daemon-reload
# Enable and start PowerDNS
sudo systemctl enable pdns
sudo systemctl start pdns
# Check status
sudo systemctl status pdns
# Check if PowerDNS is listening on port 53
sudo ss -tulnp | grep :53
# Query the server to verify it's working
dig @localhost google.com
# Check logs if needed
sudo journalctl -u pdns -f
sudo apt install pdns-server
sudo dnf install pdns
Note: Distribution packages may be significantly outdated. Using official PowerDNS repositories is strongly recommended.
For the latest development version or custom builds:
# Install build dependencies (Ubuntu/Debian example)
sudo apt install build-essential cmake libboost-all-dev libssl-dev liblua5.3-dev libsystemd-dev pkg-config
# Clone the repository
git clone https://github.com/PowerDNS/pdns.git
cd pdns
# Build and install (follow official documentation for detailed steps)
mkdir build && cd build
cmake ..
make
sudo make install
Port 53 already in use: Another DNS service (like systemd-resolved) may be running
sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved
# Update /etc/resolv.conf to use external DNS servers
Database connection errors: Verify credentials and database schema
# Test database connectivity
mysql -u pdns -p -e "SHOW TABLES;" pdns
Permission errors: Ensure PowerDNS user has proper file permissions
sudo chown -R pdns:pdns /var/lib/powerdns
Repository signature errors: Verify GPG key is correctly installed
# Check GPG key (Debian/Ubuntu)
gpg --show-keys /etc/apt/keyrings/pdns-archive-keyring.gpg
# Should show key ID: FD380FBB
Schema not found: Database schema path varies by distribution
# Find schema location
find /usr/share -name "schema.mysql.sql" 2>/dev/null
find /usr/share -name "schema.pgsql.sql" 2>/dev/null
Deploying authoritative DNS servers or recursors can be complex. We offer consulting services for:
Contact us at office@linux-server-admin.com or visit our contact page.