deployment:network:powerdns:install-postgres

This is an old revision of the document!


PowerDNS : Installasi dengan posgresSQL Backend (Debian 12/13)

Update repository:

apt update

Install PowerDNS Authoritative + PostgreSQL:

apt install pdns-server pdns-backend-pgsql postgresql

Pastikan service PostgreSQL berjalan:

systemctl status postgresql

Buat database dan user:

sudo -u postgres psql <<EOF
CREATE DATABASE powerdns;
CREATE USER pdns WITH PASSWORD 'passwordku';
ALTER DATABASE powerdns OWNER TO pdns;
GRANT ALL PRIVILEGES ON DATABASE powerdns TO pdns;
EOF

Import schema bawaan PowerDNS:

sudo -u postgres psql powerdns < /usr/share/pdns-backend-pgsql/schema/schema.pgsql.sql

Grant Permission to user pdns:

sudo -u postgres psql powerdns <<EOF
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO pdns;
GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO pdns;
GRANT ALL PRIVILEGES ON SCHEMA public TO pdns;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON TABLES TO pdns;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL PRIVILEGES ON SEQUENCES TO pdns;
EOF

Cek tabel sudah dibuat:

sudo -u postgres psql powerdns -c "\dt"

Sometimes server linux terutama cloud images, menggunakan systemd-resolved yang menggunakan port 53 secara default. Kita ingin mendisable hal berikut untuk dapat digunakan PowerDNS Nanti.

Disable systemd-resolved

sudo systemctl disable systemd-resolved --now

hapus stub resolv.conf:

sudo rm /etc/resolv.conf

buat manual resolv.conf:

sudo nano /etc/resolv.conf

Sesuaikan dengan dns server kalian: Contoh:

nameserver 8.8.8.8
nameserver 1.1.1.1

Hapus bind.conf dikarenakan kita menggunakan psql sebagai our backend

rm /etc/powerdns/pdns.d/bind.conf

Buat konfigurasi powerdns database connetion sesuai dengan database kita

nano /etc/powerdns/pdns.d/gpgsql.conf
launch=gpgsql
gpgsql-host=127.0.0.1
gpgsql-port=5432
gpgsql-dbname=powerdns
gpgsql-user=pdns
gpgsql-password=passwordku

Restart Service

systemctl restart pdns
systemctl enable pdns
systemctl status pdns
  • deployment/network/powerdns/install-postgres.1772129130.txt.gz
  • Last modified: 2026/02/27 01:05
  • by ilyasa