1、编译前环境准备

[root@centfils ~]# yum groupinstall "Development Tools" "Server Platform Development"

2、至isc.org bind官网下载bind源码,并展开

[root@centfils ~]# tar xf bind-9.9.9-P2.tar.gz
[root@centfils ~]# cd bind-9.9.9-P2


3、创建named用户

[root@centfils bind-9.9.9-P2]# group -r -g 53 named
[root@centfils bind-9.9.9-P2]# useradd -u 53 -g named named -r
#使用53端口作为named组和named用户的ID号


4、编译安装

[root@centfils bind-9.9.9-P2]# ./configure --prefix=/usr/local/bind9.9 --sysconfdir=/etc/named/ --disable-chroot --enable-threads
#指明安装位置,配置文件位置,关闭chroot,开启线程

[root@centfils bind-9.9.9-P2]# make
[root@centfils bind-9.9.9-P2]# make install


至此,安装完成,但自行编译bind源码包会产生如下问题

(1)没有配置文件

(2)没有区域解析文件(包括13个根服务器的解析文件)

(3)没有rndc的相关配置文件


解决上述问题

#1、将bind下配置文件加入PATH中
[root@centfils bind9.9]# vim /etc/profile.d/named.sh
export PATH=/usr/local/bind9.9/bin:/usr/local/bind9.9/sbin:$PATH
[root@centfils bind9.9]# . /etc/profile.d/named.sh

#2、导出库文件搜索路径
[root@centfils bind9.9]# vim /etc/ld.so.conf.d/named.conf
/usr/local/bind9.9/lib
[root@centfils bind9.9]# ldconfig -v

#3、导出头文件搜索路径
[root@centfils bind9.9]# ln -sv /usr/local/bind9.9/include /us