Instalasi dan Konfigurasi DNS Server Pada Debian 10 Buster

3 min read 3 hours ago
Published on Nov 06, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

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.

  1. Open the terminal.
  2. Edit the network interfaces file:
    sudo nano /etc/network/interfaces
    
  3. 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>
    
  4. Save the changes and exit the editor (Ctrl + X, then Y, and Enter).
  5. Restart the networking service:
    sudo systemctl restart networking
    

Step 2: Update the System

Ensure your system is up to date before installation.

  1. Update the package list:
    sudo apt update
    
  2. Upgrade installed packages:
    sudo apt upgrade -y
    

Step 3: Install the DNS Server

Next, install the BIND9 DNS server.

  1. Install BIND9:
    sudo apt install bind9 bind9utils bind9-doc -y
    
  2. 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.

  1. Edit the BIND configuration file:
    sudo nano /etc/bind/named.conf.local
    
  2. Add your domain configuration. For example:
    zone "example.com" {
        type master;
        file "/etc/bind/db.example.com";
    };
    
  3. Create the DNS zone file:
    sudo cp /etc/bind/db.local /etc/bind/db.example.com
    
  4. Edit the newly created zone file:
    sudo nano /etc/bind/db.example.com
    
  5. 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.

  1. Check the BIND configuration for errors:
    sudo named-checkconf
    
  2. Check the zone file for errors:
    sudo named-checkzone example.com /etc/bind/db.example.com
    
  3. Restart BIND to apply changes:
    sudo systemctl restart bind9
    

Step 6: Install Apache Web Server

To serve web pages, install the Apache web server.

  1. Install Apache:
    sudo apt install apache2 -y
    
  2. 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.

  1. Open a web browser and enter your server's IP address or domain name:
    http://<your_static_ip>/
    
  2. 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.