DEV Community

Janak Shrestha
Janak Shrestha

Posted on

Installing and Enabling DNS Services: A Guide to Deploying bind on Multiple Servers

Some new requirements have been shared by the Nautilus application development team, a new package need to be installed on all app servers in Stratos Datacenter.

Install the bind package on all app servers in Stratos Datacenter and start/enable its service.


Solution

Step 1: Connect to Each App Server and Install bind

App Server 1 (stapp01) - User: tony

ssh tony@stapp01
# Password: Ir0nM@n
sudo su -
# Password: Ir0nM@n
yum install -y bind
systemctl start named
systemctl enable named
systemctl status named
exit
exit
Enter fullscreen mode Exit fullscreen mode

App Server 2 (stapp02) - User: steve

ssh steve@stapp02
# Password: Am3ric@
sudo su -
# Password: Am3ric@
yum install -y bind
systemctl start named
systemctl enable named
systemctl status named
exit
exit
Enter fullscreen mode Exit fullscreen mode

App Server 3 (stapp03) - User: banner

ssh banner@stapp03
# Password: BigGr33n
sudo su -
# Password: BigGr33n
yum install -y bind
systemctl start named
systemctl enable named
systemctl status named
exit
exit
Enter fullscreen mode Exit fullscreen mode

One-Line Commands

App Server 1 (stapp01):

echo 'Ir0nM@n' | ssh tony@stapp01 "sudo -S bash -c 'yum install -y bind && systemctl start named && systemctl enable named && systemctl status named'"
Enter fullscreen mode Exit fullscreen mode

App Server 2 (stapp02):

echo 'Am3ric@' | ssh steve@stapp02 "sudo -S bash -c 'yum install -y bind && systemctl start named && systemctl enable named && systemctl status named'"
Enter fullscreen mode Exit fullscreen mode

App Server 3 (stapp03):

echo 'BigGr33n' | ssh banner@stapp03 "sudo -S bash -c 'yum install -y bind && systemctl start named && systemctl enable named && systemctl status named'"
Enter fullscreen mode Exit fullscreen mode

Automated Script (Run from Jump Host)

#!/bin/bash

# Define servers with their credentials
declare -A SERVERS=(
    ["stapp01"]="tony:Ir0nM@n"
    ["stapp02"]="steve:Am3ric@"
    ["stapp03"]="banner:BigGr33n"
)

echo "========================================="
echo "Installing bind on all App Servers"
echo "========================================="

for server in "${!SERVERS[@]}"; do
    IFS=':' read -r user pass <<< "${SERVERS[$server]}"
    echo ""
    echo "-----------------------------------------"
    echo "Processing $server (User: $user)"
    echo "-----------------------------------------"

    sshpass -p "$pass" ssh -o StrictHostKeyChecking=no $user@$server "sudo -S bash -c '
        echo \"Installing bind package...\"
        yum install -y bind

        echo \"Starting named service...\"
        systemctl start named

        echo \"Enabling named service on boot...\"
        systemctl enable named

        echo \"Service Status:\"
        systemctl status named | grep -E \"Active|Loaded\"

        echo \"✓ bind installed and started on $server\"
    '"

    if [ $? -eq 0 ]; then
        echo "✅ $server completed successfully"
    else
        echo "❌ Failed to configure $server"
    fi
done

echo ""
echo "========================================="
echo "✅ bind installed on all App servers!"
echo "========================================="
Enter fullscreen mode Exit fullscreen mode

Expected Output

[root@stapp01 ~]# yum install -y bind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Package bind-9.11.36-8.el8.x86_64 already installed and latest version
Nothing to do

[root@stapp01 ~]# systemctl start named
[root@stapp01 ~]# systemctl enable named
Created symlink from /etc/systemd/system/multi-user.target.wants/named.service to /usr/lib/systemd/system/named.service.

[root@stapp01 ~]# systemctl status named
● named.service - Berkeley Internet Name Domain (DNS)
   Loaded: loaded (/usr/lib/systemd/system/named.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2026-08-27 10:00:00 UTC; 1min ago
 Main PID: 12345 (named)
   CGroup: /system.slice/named.service
           └─12345 /usr/sbin/named -u named -c /etc/named.conf
Enter fullscreen mode Exit fullscreen mode

Verification Commands

# Verify bind package installed
rpm -qa | grep bind

# Verify service is running
systemctl status named

# Verify service is enabled
systemctl is-enabled named

# Check named process
ps aux | grep named

# Check listening ports (DNS uses port 53)
netstat -tlnp | grep named
ss -tlnp | grep named
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

  1. "Failed to start named":
   # Check logs
   journalctl -u named -n 50
   # Check configuration
   named-checkconf
Enter fullscreen mode Exit fullscreen mode
  1. "Package bind not found":
   # Check available packages
   yum search bind
   # Enable EPEL repository if needed
   yum install -y epel-release
Enter fullscreen mode Exit fullscreen mode
  1. "Permission denied":
   # Ensure using sudo
   sudo yum install -y bind
Enter fullscreen mode Exit fullscreen mode

Summary

  • bind installed on stapp01, stapp02, stapp03
  • named service started on all servers
  • named service enabled on boot
  • ✅ Service status verified

The bind package has been successfully installed and the named service is running on all App servers.

Top comments (0)