Chinaunix首页 | 论坛 | 博客
  • 博客访问: 322880
  • 博文数量: 27
  • 博客积分: 3026
  • 博客等级: 中校
  • 技术积分: 415
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-19 13:43
文章分类

全部博文(27)

文章存档

2013年(2)

2010年(4)

2008年(21)

分类: 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

阅读(1783) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~