分类: LINUX
2008-07-03 18:12:06
二进制安装方式:
# apt-get install bind9
# vi /etc/init.d/bind9
========+========+========+========+========
mkdir -p /var/named/run 24行
chmod 775 /var/named/run 25行
chown root:bind /var/named/run >/dev/null 2>&1 || true 26行
if start-stop-daemon --start --quiet --exec \ 34行
/usr/sbin/named -- $OPTIONS; then
========+========+========+========+========
# /etc/default/bind9
OPTIONS="-u bind -t /var/named -c /etc/named.conf"
# makdir /var/named
# cp -R dev etc log master run standard /var/named/
# chown -R bind:root /var/named/log
# cp /var/named/etc/rndc.conf /etc/bind/
测试:
# named -u bind -t /var/named -gc /etc/named.conf
源代码安装方式:
# proz
# tar -zxvf bind-9.3.4-P1.tar.gz
# cd bind-9.3.4-P1
# ./configure --prefix=/usr/local/named \
--disable-openssl-version-check
# make
# make install
# vi /etc/init.d/named
========+========+========+========+========
#!/bin/sh
#
case "$1" in
start)
/usr/local/named/sbin/named -t /var/named -u bind \
-c /etc/named.conf && echo . && echo 'named started.'
;;
stop)
kill `cat /var/named/run/named.pid` && echo 'named stopped.'
;;
restart)
echo .
echo "Restart BIND9 server"
$0 stop
sleep 10
$0 start
;;
*)
echo "$0 start | stop | restart"
;;
esac
========+========+========+========+========
# chmod 755 /etc/init.d/named
# makdir /var/named
# cp -R dev etc log master run standard /var/named/
# chown -R bind:root /var/named/log
# cp /var/named/etc/rndc.conf /usr/local/named/etc/
# ln -s /usr/local/named/sbin/named /usr/sbin/named
# ln -s /usr/local/named/sbin/rndc /usr/sbin/rndc
测试:
# useradd -d /dev/null -s /sbin/nologin named
# named -u bind -t /var/named -gc /etc/named.conf