Skip to content

My Digital Crib

Menu
Menu

NAME: Setting up PowerDNS + Poweradmin on FreeBSD 13

Posted on August 12, 2021August 12, 2021 by toor

DISCLAIMER: This guide assumes you have a working installation of FreeBSD 13 with Nginx, MySQL/MariaDB and PHP 7.4.x installed and running with updated Ports tree. If you haven’t done it, SKIP this guide and do that first.

Execute all commands as the user root.

Let’s start by installing PowerDNS:

$ cd /usr/ports/dns/powerdns
$ make install clean

Next download Poweradmin and place in /usr/local/www directory

$ cd /usr/local/www
$ wget https://github.com/poweradmin/poweradmin/archive/refs/heads/master.zip
$ unzip -d . master.zip
$ mv poweradmin-master poweradmin
$ chown -R www:www poweradmin

Next create the database for PowerDNS:

$ mysql -u root -p
$ grant all privileges on powerdns.* to 'powerdns'@'localhost' identified by 'secure password';
$ flush privileges;
$ exit

$ mysql -u powerdns -p
< enter secure password >
$ create database powerdns;
$ exit

Next import the schema into the database. This will create the necessary tables for PowerDNS:

$ mysql -u powerdns -p powerdns < /usr/local/share/doc/powerdns/schema.mysql.sql

At this point the database structure is ready for PowerDNS. PowerDNS will be acting as a primary/master nameserver for our domains. So let’s get the configuration file ready:

$ cd /usr/local/etc/pdns # Create this directory if it doesn't exists: mkdir pdns
$ cat <<- _EOF > pdns.conf
# - PowerDNS Configuration -
allow-axfr-ips=1.2.3.4,2001:db8:1::1 # Slave DNS servers for zone transfers
only-notify=1.2.3.4 # Notify Slave DNS when a zone is updated

daemon=yes
server-id=ns1.domain.com
default-soa-content=@ 0 10800 3600 604800 3600
default-soa-edit=increment-weeks
disable-axfr=no
disable-syslog=no
include-dir=/usr/local/etc/pdns/conf.d
local-address=127.0.0.1 10.10.10.1 ::1 2001:db8:10::1 # Change this to your server's IP/IPv6 address
local-port=53
log-dns-details=no
log-dns-queries=yes
logging-facility=0
loglevel=4
primary=yes
query-local-address=10.10.10.1 2001:db8:10::1 # Change this to your server's IP/IPv6 address
query-logging=no
setgid=pdns
setuid=pdns
version-string=PowerDNS
_EOF

Next create a config file for MySQL/MariaDB in /usr/local/etc/pdns/conf.d/ directory:

$ mkdir /usr/local/etc/pdns/conf.d
$ cd /usr/local/etc/pdns/conf.d/
$ cat <<- _EOF > mysql.conf
launch=gmysql
gmysql-dnssec=yes
gmysql-host=127.0.0.1
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=secure password
_EOF

At this point the setup for PowerDNS is done. Next activate the service so it starts on boot:

$ sysrc pdns_enable="YES"
$ service pdns start
$ pdns_control status
$ 12132: Child running on pid 54363 # <-- If you see this it means PowerDNS is successfully up and running.

Last thing to do is point your browser at http://your_server_name/poweradmin/install and follow the steps to setup. You will need to write down the following:

  • db_name # <– powerdns
  • db_host # <– Set this to 127.0.0.1
  • db_port # <– ‘3306’ is the default
  • db_user # <– powerdns
  • db_pass # <– powerdns secure password

When the setup is done, browse and login to your new Poweradmin Control Panel at http://your_server_name/poweradmin

However if you see that you are missing some PHP extensions, go ahead and install them:

$ cd /usr/ports/lang/php74-extensions
$ make config # <-- Pick which extensions you want
$ make install clean
$ service php-fpm restart

I hope this guide has helped some of you. If you have questions or suggestions, feel free to email me @ drl_AT_bsd_DOT_my

Recent Posts

  • NAME: Setting up PowerDNS + Poweradmin on FreeBSD 13
  • NAME: Installing a dual-stack OpenVPN server on FreeBSD 13

Archives

  • August 2021

Categories

  • Guides
© 2025 My Digital Crib | Powered by Minimalist Blog WordPress Theme