In this comprehensive guide, we will walk you through the process of how to install PowerDNS on your Oracle Linux server. PowerDNS is an open-source DNS server that is easy to configure and offers a wide range of features. By the end of this tutorial, you will have a fully functional PowerDNS server set up on your Oracle Linux system.
Table of Contents
- Prerequisites
- Installing PowerDNS
- Configuring PowerDNS
- Setting up a PowerDNS backend
- Testing your PowerDNS installation
- Conclusion
Prerequisites
Before you begin, make sure you have the following in place:
- An Oracle Linux server
- Root or sudo access to the server
- A basic understanding of Linux commands and server administration
- LAMP Stack Installed on Oracle Linux
- MariaDB Server Installed on Oracle Linux
How to Install PowerDNS on Oracle Linux
Installing PowerDNS on Oracle Linux
First, you will need to install the EPEL repository on your Oracle Linux system. EPEL (Extra Packages for Enterprise Linux) provides additional packages for Red Hat-based distributions, including Oracle Linux. To install the EPEL repository, run the following command:
sudo yum install -y epel-release
Now that the EPEL repository is enabled, you can proceed to install PowerDNS and its MySQL backend by running the following command:
sudo yum install -y pdns pdns-backend-mysql
This command will install PowerDNS and the necessary backend package for MySQL/MariaDB integration.
Configure PowerDNS on Oracle Linux
After the installation is complete, you will need to configure PowerDNS. To do this, edit the /etc/pdns/pdns.conf
file using your preferred text editor, such as vim:
sudo vim /etc/pdns/pdns.conf
Add the following lines to the configuration file, replacing {db_user}
, {db_password}
, and {db_name}
with your database credentials:
launch=gmysql
gmysql-host=localhost
gmysql-user={db_user}
gmysql-password={db_password}
gmysql-dbname={db_name}
Save the file and exit the text editor.
Setting up a PowerDNS backend
Now that PowerDNS is configured, it’s time to set up the database backend. In this tutorial, we will use MariaDB as our backend. First, log in to your MariaDB server:
mysql -u root -p
Enter your MariaDB root password when prompted. Next, create a new database and user for PowerDNS:
CREATE DATABASE pdns;
GRANT ALL PRIVILEGES ON pdns.* TO 'pdns_user'@'localhost' IDENTIFIED BY 'pdns_password';
FLUSH PRIVILEGES;
Remember to replace 'pdns_user'
and 'pdns_password'
with your desired username and password. Now, create the necessary tables for PowerDNS:
account VARCHAR(40) DEFAULT NULL,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE UNIQUE INDEX name_index ON domains(name);
CREATE TABLE records (
id INT AUTO_INCREMENT,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(10) DEFAULT NULL,
content VARCHAR(64000) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
disabled TINYINT(1) DEFAULT 0,
ordername VARCHAR(255) BINARY DEFAULT NULL,
auth TINYINT(1) DEFAULT 1,
PRIMARY KEY (id)
) Engine=InnoDB;
CREATE INDEX nametype_index ON records(name, type);
CREATE INDEX domain_id ON records(domain_id);
CREATE INDEX ordername ON records (ordername);
ALTER TABLE records ADD CONSTRAINT records_ibfk_1 FOREIGN KEY (domain_id) REFERENCES domains(id) ON DELETE CASCADE;
CREATE TABLE supermasters (
ip VARCHAR(64) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) NOT NULL,
PRIMARY KEY (ip, nameserver)
) Engine=InnoDB;
These SQL commands create the domains
, records
, and supermasters
tables required by PowerDNS. Once you have executed the commands, exit MariaDB by typing exit
.
Now, update the /etc/pdns/pdns.conf
file with the database credentials you created earlier:
sudo vim /etc/pdns/pdns.conf
Replace {db_user}
, {db_password}
, and {db_name}
with the appropriate values:
gmysql-user=pdns_user
gmysql-password=pdns_password
gmysql-dbname=pdns
Save the file and exit the text editor. Finally, start the PowerDNS service and enable it to start at boot:
sudo systemctl start pdns
sudo systemctl enable pdns
Testing your PowerDNS installation
To test your PowerDNS installation, you can use the dig
command, which is a DNS lookup utility. First, install the bind-utils
package:
sudo yum install -y bind-utils
Now, run the dig
command to query your PowerDNS server:
dig @localhost your-domain.com
Replace your-domain.com
with a domain you have added to the PowerDNS server. If everything is set up correctly, you should see a response with the appropriate DNS records.
Conclusion
Congratulations! You have successfully installed and configured PowerDNS on Oracle Linux. You now have a powerful and flexible DNS server at your disposal. If you wish to further enhance your server, you might consider installing additional services like an FTP server, OpenVPN server, or even Ruby. For more Linux tutorials and guides, visit LinuxBoost.