快速安装CentOS+Bind9.7.2

Linux公社

 

 

首页服务器应用

背景:

阅读新闻

快速安装CentOS+Bind9.7.2-P3

[日期:2011-05-06]   来源:Linux社区  作者:fuying163   [字体:]  

第一步、安装bind-9.7.2-P3

更新yum源:

rm -rf /etc/yum.repos.d/*.repo

wget CentOS-Base.repo -O /etc/yum.repos.d/CentOS-Base.repo

yum安装openssl-devel :

yum -y install openssl-devel

进入临时安装目录:

cd /opt

获取bind版本:

wget

安装bind-9.7.2-P3

tar -zxvf bind-9.7.2-P3.tar.gz

cd bind-9.7.2-P3

./configure --enable-largefile --enable-threads --prefix=/usr/local/named
make

make install

生成密钥:

cd /usr/local/named/etc
/usr/local/named/sbin/rndc-confgen > /usr/local/named/etc/rndc.conf

tail -n10 rndc.conf |head -n9 |sed -e s/#\//g > named.conf

mkdir -p /usr/local/named/data

下载named.root

cd /usr/local/named/

wget ftp://ftp.rs.internic.net/domain/named.root

安装过程可由脚本完成,脚本内容如下,保存为install_bind.sh:

#!/bin/bash
rm -rf /etc/yum.repos.d/*.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo
yum -y install openssl-devel
cd /opt
wget
tar -zxvf bind-9.7.2-P3.tar.gz
cd bind-9.7.2-P3
./configure --enable-largefile --enable-threads --prefix=/usr/local/named
make
make install
cd /usr/local/named/etc
/usr/local/named/sbin/rndc-confgen > /usr/local/named/etc/rndc.conf
tail -n10 rndc.conf |head -n9 |sed -e s/#\//g > named.conf
mkdir -p /usr/local/named/data
cd /usr/local/named/
wget ftp://ftp.rs.internic.net/domain/named.root
exit 1

执行sh脚本;

第二步、修改配置文件

named.conf、rndc.conf这两个配置文件位置为:/usr/local/named/etc

域名相关的配置文件位置为:/usr/local/named

2-1、修改named.conf

修改后内容如下:


options {
        directory "/usr/local/named";
        pid-file "named.pid";
        listen-on port 53 {any;};
        allow-query {any;};
        dump-file "/usr/local/named/data/cache_dump.db";
        statistics-file "/usr/local/named/data/named_stats.txt";
        forward only;               //增加转发功能
        forwarders {
                202.106.0.20;       //北京网通DNS服务器地址
                139.175.10.20;
        };

};

key "rndc-key" {
        algorithm hmac-md5;
        secret "jhdbq+u4cE6KJdrJ6m6yAA==";  //注意“”号中的内容需要和rndc.conf中生成的key值一样;
};
 
controls {
        inet 127.0.0.1 port 953
                allow { 127.0.0.1; } keys { "rndc-key"; };
};
 
zone "."  IN {
        type hint;
        file "named.root";
};

zone "localhost" IN {
         type master;
         file "localhost.zone";
         allow-update { none; };
};

zone "0.0.127.in-addr.arpa" IN {
         type master;
         file "localhost.rev";
         allow-update { none; };
};

zone "linuxidc.com" IN {
         type  master;
         file "linuxidc.com.zone";
         allow-update { none; };
};

zone "1.168.192.in-addr.arpa" IN {
        type master;
        file "192.168.1.zone";
        allow-update { none; };
};

2-2、生成域名的配置文件

cd /usr/local/named

修改localhost.zone文件:

vi localhost.zone

内容如下:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wywffp.html