On the Debian system download the bind9 package with:
sudo apt-get install bind9 dnsutils
Next, follow what’s in this script (or type them in one at a time): chroot-bind.sh
#!/bin/bash
#------------------ Variables------------------- #
ME=`/usr/bin/whoami`
DIRECTORY=/etc/bind
#------------------------------------------------#
# Some Error Checking #
if [ $UID -ne 0 ]; then
echo "Sorry but you must be root to run this script"
exit 1
fi
if [ ! -d "$DIRECTORY" ]; then
echo "The $DIRECTORY doesn't exist. This would mean that bind9 is not installed"
echo "You can install bind9 with the command:"
echo ""
echo "apt-get install bind9"
exit 1
fi
# Main Routine #
/etc/init.d/bind9 stop
/bin/sed -i 's/RESOLVCONF=no/RESOLVCONF=yes/' /etc/default/bind9
/bin/sed -i 's|-u bind|-u bind -t /var/lib/named|' /etc/default/bind9
mkdir -p /var/lib/named/{etc,dev,var/cache/bind,var/run/bind/run}
mv /etc/bind /var/lib/named/etc
ln -s /var/lib/named/etc/bind /etc/bind
mknod /var/lib/named/dev/null c 1 3
mknod /var/lib/named/dev/random c 1 8
chmod 666 /var/lib/named/dev/{null,random}
chown -R bind:bind /var/lib/named/var/*
chown -R bind:bind /var/lib/named/etc/bind
# Add below so messages are still sent to syslog
echo "\$AddUnixListenSocket /var/lib/named/dev/log" > /etc/rsyslog.d/bind-chroot.conf
/etc/init.d/rsyslog restart
/etc/init.d/bind9 start
Now configure for your Environment:
http://chschneider.eu/linux/server/bind9.shtml
That’s probably easiest.