- Forums
- Linux Systems
- How To Install DNS Server In Debian Installing BIND DNS
This Page Contains information about How To Install DNS Server In Debian Installing BIND DNS By wallpaperama in category Linux Systems with 1 Replies. [2955], Last Updated: Sat May 18, 2024
wallpaperama
Sun Jul 08, 2007
1 Comments
4012 Visits
use this command to install a DNS server in debian. i use this command to install BIND9 in the shell prompt with apt-get:
command:
apt-get install bind9
After you send this command you get a prompt to install BIND, type Y for yes.
Reading Package Lists... Done
Building Dependency Tree... Done
The following extra packages will be installed:
libdns16 libisc7 libisccc0 libisccfg0 liblwres1
Suggested packages:
dnsutils bind9-doc
The following NEW packages will be installed:
bind9 libdns16 libisc7 libisccc0 libisccfg0 liblwres1
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/1141kB of archives.
After unpacking 2720kB of additional disk space will be used.
Do you want to continue? [Y/n] y
continue...
Selecting previously deselected package libisc7.
(Reading database ... 9646 files and directories currently installed.)
Unpacking libisc7 (from .../bind9/libisc7_9.2.4-1_i386.deb) ...
Selecting previously deselected package libdns16.
Unpacking libdns16 (from .../libdns16_9.2.4-1_i386.deb) ...
Selecting previously deselected package liblwres1.
Unpacking liblwres1 (from .../liblwres1_9.2.4-1_i386.deb) ...
Selecting previously deselected package libisccc0.
Unpacking libisccc0 (from .../libisccc0_9.2.4-1_i386.deb) ...
Selecting previously deselected package libisccfg0.
Unpacking libisccfg0 (from .../libisccfg0_9.2.4-1_i386.deb) ...
Selecting previously deselected package bind9.
Unpacking bind9 (from .../b/bind9/bind9_9.2.4-1_i386.deb) ...
Setting up libisc7 (9.2.4-1) ...
Setting up libdns16 (9.2.4-1) ...
Setting up liblwres1 (9.2.4-1) ...
Setting up libisccc0 (9.2.4-1) ...
Setting up libisccfg0 (9.2.4-1) ...
Setting up bind9 (9.2.4-1) ...
Adding group `bind' (104)...
Done.
Adding system user `bind'...
Adding new user `bind' (101) with group `bind'.
Not creating home directory.
Starting domain name service: named.
now, you need to stop named to install chroot for security purposes. so execute this command to stop nind9
command:
/etc/init.d/bind9 stop
edit the bind9 file:
nano /etc/default/bind9
bind9 will look something like this:
OPTIONS="-u bind"
now add
-t /var/lib/named to make it look like this:
OPTIONS="-u bind -t /var/lib/named"
save the the file with the new changes.
now you need to create the files needed for chroot to work, so sent these commands:
commands to make directories:
mkdir -p /var/lib/named/etc
mkdir /var/lib/named/dev
mkdir -p /var/lib/named/var/cache/bind
mkdir -p /var/lib/named/var/run/bind/run
move config directory from /etc to /var/lib/named/etc
mv /etc/bind /var/lib/named/etc
Create a symlink to the new config directory from the old location (to avoid problems when bind is upgraded in the future):
ln -s /var/lib/named/etc/bind /etc/bind
Make null and random devices, and fix permissions of the directories:
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 /var/lib/named/dev/random
chown -R bind:bind /var/lib/named/var/*
chown -R bind:bind /var/lib/named/etc/bind
edit /etc/init.d/sysklogd of sysklogd to get important messages logged to the system logs. Modify the line: SYSLOGD="" to SYSLOGD="-a /var/lib/named/dev/log"
edit /etc/init.d/sysklogd
nano /etc/init.d/sysklogd
the file may first look like this:
#! /bin/sh
# /etc/init.d/sysklogd: start the system log daemon.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
pidfile=/var/run/syslogd.pid
binpath=/sbin/syslogd
test -x $binpath || exit 0
# Options for start/restart the daemons
# For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD=""
create_xconsole()
{
if [ ! -e /dev/xconsole ]; then
mknod -m 640 /dev/xconsole p
else
chmod 0640 /dev/xconsole
fi
chown root:adm /dev/xconsole
}
running()
{
# No pidfile, probably no daemon present
#
if [ ! -f $pidfile ]
then
return 1
fi
pid=`cat $pidfile`
# No pid, probably no daemon present
#
if [ -z "$pid" ]
then
return 1
fi
if [ ! -d /proc/$pid ]
then
return 1
fi
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`
# No syslogd?
#
if [ "$cmd" != "$binpath" ]
then
return 1
fi
return 0
}
case "$1" in
start)
echo -n "Starting system log daemon: syslogd"
create_xconsole
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
stop)
echo -n "Stopping system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
echo "."
;;
reload|force-reload)
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pidfile
echo "."
;;
restart)
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
sleep 1
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
reload-or-restart)
if running
then
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pid$
else
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
fi
echo "."
;;
*)
echo "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|relo$
exit 1
esac
exit 0
Look for
SYSLOGD="" and change it to
SYSLOGD="-a /var/lib/named/dev/log"
#! /bin/sh
# /etc/init.d/sysklogd: start the system log daemon.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
pidfile=/var/run/syslogd.pid
binpath=/sbin/syslogd
test -x $binpath || exit 0
# Options for start/restart the daemons
# For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD="-a /var/lib/named/dev/log"
create_xconsole()
{
if [ ! -e /dev/xconsole ]; then
mknod -m 640 /dev/xconsole p
else
chmod 0640 /dev/xconsole
fi
chown root:adm /dev/xconsole
}
running()
{
# No pidfile, probably no daemon present
#
if [ ! -f $pidfile ]
then
return 1
fi
pid=`cat $pidfile`
# No pid, probably no daemon present
#
if [ -z "$pid" ]
then
return 1
fi
if [ ! -d /proc/$pid ]
then
return 1
fi
cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`
# No syslogd?
#
if [ "$cmd" != "$binpath" ]
then
return 1
fi
return 0
}
case "$1" in
start)
echo -n "Starting system log daemon: syslogd"
create_xconsole
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
stop)
echo -n "Stopping system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
echo "."
;;
reload|force-reload)
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pidfile
echo "."
;;
restart)
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
sleep 1
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
reload-or-restart)
if running
then
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pid$
else
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
fi
echo "."
;;
*)
echo "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|relo$
exit 1
esac
exit 0
now you can restart the logging daemon:
/etc/init.d/sysklogd restart
Now that we've made the necessary changes, you can start bind
/etc/init.d/bind9 start
Next if you want to
install MYSQL Server Click here