Instalasi dan Konfigurasi DNS Server Pada Debian 10 Buster
Table of Contents
Introduction
This tutorial provides a comprehensive guide on installing and configuring a DNS server on Debian 10 Buster. It covers essential steps including assigning an IP address, installing the DNS server and Apache web server, configuring both services, and testing their functionality. This is crucial for anyone looking to set up a reliable DNS and web service on their Debian server.
Step 1: Assign a Static IP Address
Before setting up the DNS server, you need to configure a static IP address for your Debian server.
- Open the terminal.
- Edit the network interfaces file:
sudo nano /etc/network/interfaces
- Add the following configuration (modify according to your network settings):
auto eth0 iface eth0 inet static address <your_static_ip> netmask <your_netmask> gateway <your_gateway_ip> dns-nameservers <your_dns_servers>
- Save the changes and exit the editor (Ctrl + X, then Y, and Enter).
- Restart the networking service:
sudo systemctl restart networking
Step 2: Update the System
Ensure your system is up to date before installation.
- Update the package list:
sudo apt update
- Upgrade installed packages:
sudo apt upgrade -y
Step 3: Install the DNS Server
Next, install the BIND9 DNS server.
- Install BIND9:
sudo apt install bind9 bind9utils bind9-doc -y
- Enable and start the BIND service:
sudo systemctl enable bind9 sudo systemctl start bind9
Step 4: Configure the DNS Server
Configure the BIND DNS server to handle DNS queries.
- Edit the BIND configuration file:
sudo nano /etc/bind/named.conf.local
- Add your domain configuration. For example:
zone "example.com" { type master; file "/etc/bind/db.example.com"; };
- Create the DNS zone file:
sudo cp /etc/bind/db.local /etc/bind/db.example.com
- Edit the newly created zone file:
sudo nano /etc/bind/db.example.com
- Update the file with your domain information:
$TTL 604800 @ IN SOA ns.example.com. admin.example.com. ( 2 ; Serial 604800 ; Refresh 86400 ; Retry 2419200 ; Expire 604800 ) ; Negative Cache TTL ; @ IN NS ns.example.com. ns IN A <your_static_ip> www IN A <your_static_ip>
Step 5: Test DNS Configuration
After configuring the DNS server, test its functionality.
- Check the BIND configuration for errors:
sudo named-checkconf
- Check the zone file for errors:
sudo named-checkzone example.com /etc/bind/db.example.com
- Restart BIND to apply changes:
sudo systemctl restart bind9
Step 6: Install Apache Web Server
To serve web pages, install the Apache web server.
- Install Apache:
sudo apt install apache2 -y
- Enable and start the Apache service:
sudo systemctl enable apache2 sudo systemctl start apache2
Step 7: Test the Web Server
Check if the Apache server is running properly.
- Open a web browser and enter your server's IP address or domain name:
http://<your_static_ip>/
- You should see the default Apache welcome page.
Conclusion
You've successfully installed and configured a DNS server and an Apache web server on Debian 10 Buster. Key steps included assigning a static IP, installing necessary software, configuring DNS settings, and verifying the installations. As next steps, consider setting up additional DNS records (like MX or TXT records) or securing your web server with HTTPS.