Install PowerDNS on Debian
Install PowerDNS on Debian
Setup Repositories & Install
Add the PowerDNS repository key and source:
1
2
3
sudo install -d /etc/apt/keyrings
sudo apt install curl
curl https://repo.powerdns.com/FD380FBB-pub.asc | sudo tee /etc/apt/keyrings/auth-49-pub.asc
Add the pdns repository:
1
echo 'deb [signed-by=/etc/apt/keyrings/auth-49-pub.asc] http://repo.powerdns.com/debian bookworm-auth-49 main' | sudo tee /etc/apt/sources.list.d/pdns.list
Create /etc/apt/preferences.d/auth-49 to prioritize this repository:
1
2
3
Package: auth*
Pin: origin repo.powerdns.com
Pin-Priority: 600
Install PowerDNS:
1
2
sudo apt-get update
sudo apt-get install pdns-server
Configure Database Backend
This guide uses pdns-backend-pgsql. Install it:
1
sudo apt install pdns-backend-pgsql
The schema file is at /usr/share/pdns-backend-pgsql/schema/schema.pgsql.sql. Apply it to your PostgreSQL database to create the required tables.
Configuration
Edit the PowerDNS configuration:
1
sudo nano /etc/powerdns/pdns.conf
Example configuration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
api=yes
api-key=[StrongAPIKey]
include-dir=/etc/powerdns/pdns.d
launch=gpgsql
gpgsql-host=[dbhost]
gpgsql-dbname=[dbname]
gpgsql-user=[dbuser]
gpgsql-password=[Strong password]
gpgsql-dnssec=yes
log-timestamp=yes
loglevel-show=no
webserver=yes
webserver-address=0.0.0.0
webserver-allow-from=0.0.0.0/0,::/0
webserver-port=8081
Test the configuration (should see successful database connection):
1
2
sudo systemctl stop pdns.service
sudo pdns_server --daemon=no --guardian=no --loglevel=9
After successful test, enable and start the service:
1
2
sudo systemctl restart pdns
sudo systemctl enable pdns
Verify port 53 is open for DNS:
1
sudo ss -alnp4 | grep pdns
References
This post is licensed under CC BY 4.0 by the author.