Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| deployment:network:powerdns:install-postgres [2026/02/27 01:05] – [Buat Database & User PostgreSQL] ilyasa | deployment:network:powerdns:install-postgres [2026/02/27 01:28] (current) – [Konfigurasi PowerDNS Database Conection] ilyasa | ||
|---|---|---|---|
| Line 103: | Line 103: | ||
| systemctl status pdns | systemctl status pdns | ||
| </ | </ | ||
| + | |||
| + | |||
| + | {{indexmenu_n> | ||
| + | ====== PowerDNS : Installasi dengan posgresSQL Backend (Debian 12/13) ====== | ||
| + | |||
| + | ==== Install Paket ==== | ||
| + | |||
| + | === Update repository: === | ||
| + | <code bash> | ||
| + | apt update | ||
| + | </ | ||
| + | |||
| + | === Install PowerDNS Authoritative + PostgreSQL: === | ||
| + | <code bash> | ||
| + | apt install pdns-server pdns-backend-pgsql postgresql | ||
| + | </ | ||
| + | |||
| + | === Pastikan service PostgreSQL berjalan: === | ||
| + | <code bash> | ||
| + | systemctl status postgresql | ||
| + | </ | ||
| + | |||
| + | ==== Buat Database & User PostgreSQL ==== | ||
| + | |||
| + | === Buat database dan user: === | ||
| + | <code sql> | ||
| + | sudo -u postgres psql <<EOF | ||
| + | CREATE DATABASE powerdns; | ||
| + | CREATE USER pdns WITH PASSWORD ' | ||
| + | ALTER DATABASE powerdns OWNER TO pdns; | ||
| + | GRANT ALL PRIVILEGES ON DATABASE powerdns TO pdns; | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | === Import schema bawaan PowerDNS: === | ||
| + | <code bash> | ||
| + | sudo -u postgres psql powerdns < / | ||
| + | </ | ||
| + | |||
| + | |||
| + | === Grant Permission to user pdns: === | ||
| + | <code sql> | ||
| + | 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: === | ||
| + | <code bash> | ||
| + | sudo -u postgres psql powerdns -c " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Konfigurasi PowerDNS conflict port dengan '' | ||
| + | Sometimes server linux terutama cloud images, menggunakan '' | ||
| + | |||
| + | === Disable systemd-resolved === | ||
| + | < | ||
| + | sudo systemctl disable systemd-resolved --now | ||
| + | </ | ||
| + | |||
| + | hapus stub resolv.conf: | ||
| + | < | ||
| + | sudo rm / | ||
| + | </ | ||
| + | |||
| + | buat manual resolv.conf: | ||
| + | < | ||
| + | sudo nano / | ||
| + | </ | ||
| + | Sesuaikan dengan dns server kalian: | ||
| + | Contoh: | ||
| + | <code bash> | ||
| + | nameserver 8.8.8.8 | ||
| + | nameserver 1.1.1.1 | ||
| + | </ | ||
| + | ==== Konfigurasi PowerDNS Database Conection ==== | ||
| + | |||
| + | |||
| + | === Hapus bind.conf dikarenakan kita menggunakan psql sebagai our backend === | ||
| + | <code bash> | ||
| + | rm / | ||
| + | </ | ||
| + | |||
| + | === Buat konfigurasi powerdns database connetion sesuai dengan database kita === | ||
| + | <code bash> | ||
| + | nano / | ||
| + | </ | ||
| + | <code bash> | ||
| + | launch=gpgsql | ||
| + | gpgsql-host=127.0.0.1 | ||
| + | gpgsql-port=5432 | ||
| + | gpgsql-dbname=powerdns | ||
| + | gpgsql-user=pdns | ||
| + | gpgsql-password=passwordku | ||
| + | </ | ||
| + | === Restart Service === | ||
| + | <code bash> | ||
| + | systemctl restart pdns | ||
| + | systemctl enable pdns | ||
| + | systemctl status pdns | ||
| + | </ | ||
| + | |||
| + | ==== Testing dengan pembuatan domain ==== | ||
| + | === Install tools === | ||
| + | |||
| + | <code bash> | ||
| + | apt install pdns-tools dnsutils -y | ||
| + | </ | ||
| + | |||
| + | === Buat Zones dengan pdnsutil === | ||
| + | |||
| + | <code bash> | ||
| + | sudo pdnsutil create-zone test.local | ||
| + | </ | ||
| + | |||
| + | === Tambahkan Recods === | ||
| + | |||
| + | <code bash> | ||
| + | # Add SOA record | ||
| + | sudo pdnsutil add-record test.local @ SOA " | ||
| + | |||
| + | # Add NS record | ||
| + | sudo pdnsutil add-record test.local @ NS ns1.test.local | ||
| + | |||
| + | # Add A record for nameserver | ||
| + | sudo pdnsutil add-record test.local ns1 A 192.168.1.1 | ||
| + | |||
| + | # Add A record for test host | ||
| + | sudo pdnsutil add-record test.local www A 192.168.1.10 | ||
| + | |||
| + | </ | ||
| + | === Verify Zones === | ||
| + | |||
| + | <code bash> | ||
| + | sudo pdnsutil list-zone test.local | ||
| + | </ | ||
| + | |||
| + | === Check Zones === | ||
| + | |||
| + | <code bash> | ||
| + | sudo pdnsutil check-zone test.local | ||
| + | </ | ||
| + | |||
| + | === Test DNS Query === | ||
| + | |||
| + | <code bash> | ||
| + | # Query your PowerDNS server directly | ||
| + | dig @127.0.0.1 www.test.local A | ||
| + | dig @127.0.0.1 test.local NS | ||
| + | dig @127.0.0.1 test.local SOA | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||