1080*80 ad

How to Install and Set Up PowerDNS Easily on Debian 11 or 10

Setting up a reliable DNS server is essential for managing your domain names and ensuring your online presence is accessible. PowerDNS is a high-performance, flexible DNS server suitable for various use cases, from small personal setups to large-scale deployments. This guide covers the straightforward process of installing and configuring PowerDNS on Debian 11 (Bullseye) or Debian 10 (Buster) using a database backend for easy zone management.

The initial step is to ensure your system is up-to-date. Open a terminal and run the following commands:
sudo apt update
sudo apt upgrade

Next, you need to install the PowerDNS server package. You also need a backend to store your DNS zone data. A common and flexible choice is a database backend like MySQL or MariaDB. For this guide, we’ll use the MariaDB backend, which is widely compatible. Install the necessary packages with this command:
sudo apt install pdns-server pdns-backend-mysql mariadb-server

After installing MariaDB, it’s highly recommended to secure your installation by running the security script:
sudo mysqlsecureinstallation
Follow the prompts to set a strong root password, remove anonymous users, disallow remote root login, and remove the test database.

Now, you need to create a database and a user for PowerDNS to use. Log in to the MariaDB server as the root user:
sudo mysql -u root -p
Enter the root password you set during the security step. Inside the MariaDB prompt, execute the following commands. Replace yourpdnsdatabase and yourpdnsuser with preferred names, and yourstrongpassword with a secure password:
CREATE DATABASE yourpdnsdatabase;
CREATE USER ‘yourpdnsuser’@’localhost’ IDENTIFIED BY ‘yourstrongpassword’;
GRANT ALL ON yourpdnsdatabase.* TO ‘yourpdnsuser’@’localhost’;
FLUSH PRIVILEGES;
EXIT;

With the database and user created, you need to import the PowerDNS schema for the MySQL/MariaDB backend. The schema file is usually located in the documentation directory. Execute this command to import it into your newly created database:
sudo mysql -u yourpdnsuser -p yourpdnsdatabase < /usr/share/doc/pdns-backend-mysql/schema.mysql.gz
When prompted, enter the password for the yourpdnsuser.

Now it’s time to configure PowerDNS to use the MariaDB backend. Edit the main configuration file, typically located at /etc/powerdns/pdns.conf:
sudo nano /etc/powerdns/pdns.conf
Find or add the following lines to specify the backend and database connection details. Make sure to use the database name, user, and password you created earlier:
backend=mysql
mysql-host=localhost
mysql-database=yourpdnsdatabase
mysql-user=yourpdnsuser
mysql-password=yourstrongpassword

You might also want to configure the listening address if you don’t want PowerDNS to listen on all interfaces (e.g., for a private DNS server or to bind only to the public IP). Add or modify the local-address directive:
local-address=0.0.0.0 (to listen on all IPv4 interfaces)
local-address=:: (to listen on all IPv6 interfaces)
or specify a specific IP address.
Save the file and exit the editor.

With the configuration complete, you can now enable and start the PowerDNS service. Enabling ensures it starts automatically at boot.
sudo systemctl enable pdns.service
sudo systemctl start pdns.service

To verify that PowerDNS is running correctly, check its status:
sudo systemctl status pdns.service
You should see output indicating the service is active and running.

You can also test that it’s listening on the expected port (UDP/TCP 53):
sudo ss -tulnp | grep 53
Look for a process named pdns_server listening on port 53.

Finally, you can test DNS resolution using a tool like dig or nslookup against your new server’s IP address once you have added some zones and records to the database. For example, if your server’s IP is 192.168.1.100:
dig @192.168.1.100 example.com (replace example.com with a domain you’ve configured)

Following these steps allows you to successfully install and set up PowerDNS with a MariaDB backend on your Debian 11 or Debian 10 system, providing a solid foundation for managing your DNS infrastructure.

Source: https://kifarunix.com/easily-install-and-setup-powerdns-on-debian-11-debian-10/

900*80 ad

      1080*80 ad