3、安装Bind
a、 #tar –zxvf bind-9.2.1.tar.gz
#cd bind-9.2.1
#./configure --prefix=/opt/bind --with-libtool --enable-threads
#make
#make install
这种编译源码的安装方式是不会自动创建named.conf和工作目录的,要手工创建。
b、建立named用户和相应文件夹:
#mkdir /opt/bind/etc
#mkdir /opt/bind/var
#mkdir /opt/bind/var/named
#mkdir -p /opt/bind/var/named/run
#useradd -u 25 -d /opt/bind/var/named -s /bin/false named
#chown -R named /opt/bind/var /opt/bind/etc(因为要在这个etc目录下建立named.pid文件)
运行/opt/bind/sbin/rndc-confgen获得rndc-key,利用生成的信息建立rndc.conf,保存在/opt/bind/etc下:
key "rndc-key" {
algorithm hmac-md5;
secret "Gm8BCInQhk4OtQtwVjOE/w==";
};
options {
default-key "rndc-key";
default-server 127.0.0.1;
default-port 953;
};
c、建立/opt/bind/etc/named.conf文件(只是基本型,进阶型还没有研究):
options {
directory "/opt/bind/var/named";
pid-file "/opt/bind/etc/named.pid";
notify yes;
allow-transfer {
210.xx.xx.xx;
};
};
zone "." {
type hint;
file "named.root";
};
zone "0.0.127.IN-ADDR.ARPA" {
type master;
file "Localhost";
};
zone "cc.net" {
type master;
file "cc.net.hosts";
};
key "rndc-key" {
algorithm hmac-md5;
secret "Gm8BCInQhk4OtQtwVjOE/w==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
d、在工作目录/opt/bind/var/named中生成named.conf文件中标记的文件:
#vi named.root