# Installation

This doku could be used for master and slace installations.

  1. Install mysql server and other dependencies
apt install mariadb-server mariadb-client curl gnupg2 -y
  1. Run the mysql_secure_installation with the default settings.
  2. Add the PowerDNS Repo, pin to it and add the apt key
echo "deb [arch=amd64] http://repo.powerdns.com/debian bullseye-auth-46 main" >> /etc/apt/sources.list

printf "Package: pdns-*
Pin: origin repo.powerdns.com
Pin-Priority: 600" > /etc/apt/preferences.d/pdns

curl https://repo.powerdns.com/FD380FBB-pub.asc | sudo apt-key add -
  1. Install powerdns and stop the service
apt-get update && apt-get install pdns-server pdns-backend-mysql -y
systemctl stop pdns
  1. Create the powerdns user and database:
mysql -u root
create database powerdns;
create user pdns@localhost identified by '<your password>';
grant all privieleges on pdns.* to powerdns@localhost with grant option;
flush privieleges;
exit
  1. Delete bind file (rm /etc/powerdns/pdns.d/bind.conf)
  2. Add this content to the powerdns mysql config file (/etc/powerdns/pdns.d/gmysql.conf)
conf
# MariaDB Configuration file
launch=gmysql
gmysql-host=localhost
gmysql-dbname=powerdns
gmysql-user=pdns
gmysql-password=<your password>
gmysql-dnssec=yes
  1. Download mysql table scheme and import it
wget https://raw.githubusercontent.com/PowerDNS/pdns/master/modules/gmysqlbackend/schema.mysql.sql

mysql -u root powerdns < schema.mysql.sql
  1. Now edit the folowing lines in your /etc/powerdns/pdns.conf file
#master specific config
allow-axfr-ips=127.0.0.0/8,::1,<ip of secondary ns>/32,<ip of ... ns>/32
api=yes
api-key=<your api key>
disable-axfr=no
master=yes
primary=yes
secondary=yes
version-string=anonymous
webserver-address=0.0.0.0
webserver-allow-from=127.0.0.1,::1,<list of ips which need to access the api>
xfr-cycle-interval=10
#other nodes
allow-dnsupdate-from=127.0.0.0/8,::1,<ip of ns01>/32
allow-notify-from=<ip of ns01>/32
autosecondary=yes
disable-axfr=yes
master=no
primary=no
secondary=yes
version-string=anonymous
xfr-cycle-interval=10
  1. Restart the powerdns service (systemctl restart pdns)
  2. Login to the mysql database and use the following command to set the supoermaster (MUST BE DONE ON ALL NODES!!!!!)
 INSERT INTO powerdns.supermasters (ip, nameserver, account) VALUES ('<ip of the master>', '<dns name of the master>', 'admin');