PowerDNS Part 1 – Master Server Installation (Ubuntu)

In this post, I will cover the installation of PowerDNS Authoritative server (Part 1 of 3).

Install Mariadb & start mysql_secure_installation.

sudo apt install mariadb-server
sudo mysql_secure_installation

Create the database & database user. Replace YourPassword with a strong password!

mysql -u root -p
CREATE DATABASE powerdns;
GRANT ALL ON powerdns.* TO 'powerdns_dbuser'@'localhost' IDENTIFIED BY 'YourPassword';
FLUSH PRIVILEGES;

Choose the version for your distro & follow the steps from PDNS to add the repo.
https://repo.powerdns.com/

Install pdns-server and pdns-backend-mysql.

apt install pdns-server pdns-backend-mysql

Download the correct schema for your PDNS version. (4.6 below, stable 08-05-2022)
https://github.com/PowerDNS/pdns/blob/rel/auth-4.6.x/modules/gmysqlbackend/schema.mysql.sql

Branches: rel/auth-4.*

PowerDNS Authoritative changelogs:
https://doc.powerdns.com/authoritative/changelog/

Download & import the schema.

mysql -u powerdns_dbuser -p powerdns < /usr/share/pdns-backend-mysql/schema/schema.mysql.sql

Create the MySQL config:

nano /etc/powerdns/pdns.d/pdns.local.gmysql.conf

Replace YourPassword & paste it in pdns.local.gmysql.conf.

launch=gmysql
gmysql-host=localhost
gmysql-dbname=powerdns
gmysql-user=powerdns_dbuser
gmysql-password=YourPassword
gmysql-dnssec=yes

Edit the PDNS configuration file.

nano /etc/powerdns/pdns.conf

Check & edit the following values.

default-soa-content
include-dir
local-address
query-local-address
server-id
master

Example:

include-dir=/etc/powerdns/pdns.d
local-address=1.2.3.4
query-local-address=1.2.3.4
server-id=ns1.yourdomain.com
master=yes
default-soa-content=ns1.yourdomain.com mail.domain.com 0 10800 3600 604800 3600

Restart powerdns.

systemctl restart pdns
systemctl enable pdns

Check the status.

systemctl status pdns

PowerDNS has been successfully installed and configured.

Leave a Comment