PowerDNS is a widely used DNS server software that can be configured to use different backends, including SQLite3. In this article, we will show you how to install PowerDNS with SQLite3 on Ubuntu 22.04 and enable the backend service.
'systemd-resolved' conflict with port 53, The first step is to configure the DNS settings in the file.
# nano /etc/systemd/resolved.conf
DNS=1.1.1.1
This will set the DNS server to 1.1.1.1, which is a popular public DNS server.
Next, create a symbolic link
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
This will ensure that the DNS settings are used by the system.
The next step is to disable the systemd-resolved service. This service is used by default in Ubuntu to handle DNS resolution and conflicts with PowerDNS. To disable the service, run the following command
systemctl disable --now systemd-resolved
Now that the DNS settings are configured and the systemd-resolved service is disabled, we can install PowerDNS and SQLite3. To do this, run the following command:
apt-get install sqlite3 pdns-server pdns-backend-sqlite3
This command will install both PowerDNS and the SQLite3 backend for PowerDNS.
The next step is to configure PowerDNS to use SQLite3 as the backend.
To do this, we will create a new file in the directory /etc/powerdns/pdns.d/
called sqlite.conf
.
In this file, we will add the following lines:
# nano /etc/powerdns/pdns.d/sqlite.conf
launch=gsqlite3
gsqlite3-database=/var/lib/powerdns/pdns.sqlite3
This tells PowerDNS to use the SQLite3 backend and the location of the SQLite3 database.
We will now create the SQLite3 database and configure the correct permissions on it with the following command:
sqlite3 /var/lib/powerdns/pdns.sqlite3 < /usr/share/doc/pdns-backend-sqlite3/schema.sqlite3.sql
sudo chown -R pdns:pdns /var/lib/powerdns
Next, we will configure PowerDNS to allow API access. To do this, open the file /etc/powerdns/pdns.conf with a text editor and add the following lines:
# nano /etc/powerdns/pdns.conf
api=yes
api-key=some_api_key_123
Replace "some_api_key_123" with the desired password you want to use.
Finally, restart the PowerDNS service to apply
systemctl restart pdns
now you have configured the powerdns, and api server is running on port 8081