系统环境:
系统:centos 6.8 mysql: 5.1 BIND: bind-9.11.0-P2.tar.gz 软件下载地址:ftp://ftp.isc.org/
一、安装并配置MySQL.
1.编译环境相关依赖包安装.
yum install openssl-devel openldap-devel unixODBC-devel gcc
2.安装MySQL数据库
yum -y install mysql mysql-server mysql-devel
3.验证是否安装成功
[[email protected] ~]# rpm -qi mysql-server
4.启动MySql服务
[[email protected] ~]# /etc/init.d/mysqld start
5.登录并设置密码
[[email protected] ~]# mysql -u root mysql> show databases; mysql> use mysql; mysql> update user set password=password(‘123456‘) where user=‘root‘;
6.开放远程登录权限
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘123456‘ WITH GRANT OPTION; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
7.设置开机启动(非必须)
[[email protected] ~]#chkconfig mysqld on
二、下载并安装Bind-DLZ
1.下载并解压Bind-DLZ软件包
[[email protected] opt]#wget ftp://ftp.isc.org/isc/bind9/9.11.0-P2/bind-9.11.0-P2.tar.gz [[email protected] opt]#tar -zxvf bind-9.11.0-P2.tar.gz
2.在64位系统上编译,您可能需要设置一些变量,以便找到适当的mysql库:
[[email protected] ~]# export CPPFLAGS="-I/usr/lib64/mysql $CPPFLAGS" [[email protected] ~]# export LDFLAGS="-L/usr/lib64/mysql $LDFLAGS" [[email protected] ~]# export LD_LIBRARY_PATH="/usr/lib64/mysql"
3.编译安装Bind-DLZ.
[[email protected] opt]# cd bind-9.11.0-P2 [[email protected] bind-9.11.0-P2]#./configure --prefix=/usr/local/bind --enable-threads --enable-largefile --disable-ipv6 --disable-openssl-version-check --with-dlz-mysql=yes [[email protected] bind-9.11.0-P2]# make [[email protected] bind-9.11.0-P2]# make install
4.查看版本并测试软件是否安装成功
[[email protected] bind-9.11.0-P2]# /usr/local/bind/sbin/named -v BIND 9.11.0-P2 <id:9713922>
5.配置rndc.conf和named.conf文件
生成rndc.conf:
[[email protected] ~]# cd /usr/local/bind/etc/ [[email protected] etc]# rndc-confgen -r /dev/urandom > rndc.conf
提供ca文件
[[email protected] etc]#wget -O named.ca http://www.internic.net/domain/named.root
创建并生成named.conf
[[email protected] etc]# tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf
生产的named.conf文件只key和controls部分,需要自己手动添加logging和options部分,完整文件如下:
[[email protected] etc]# cat named.conf key "rndc-key" { algorithm hmac-md5; secret "X0k0Uz62Actu11IXrnA48A=="; }; controls { inet 127.0.0.1 port 953 allow { 127.0.0.1; } keys { "rndc-key"; }; }; logging { channel bind_log { file "/tmp/bind.log" versions 3 size 20m; severity info; print-time yes; print-severity yes; print-category yes; }; category default { bind_log; }; }; options { listen-on port 53 { 192.168.153.130; }; directory "/usr/local/bind"; Pid-file "named.pid"; allow-query-cache { any; }; allow-query { any; }; };
6.创建named用户,使bind服务以named用户运行,
[[email protected] ~]#groupadd -r -g 25 named [[email protected] ~]#useradd -r -u 25 -s /bin/nologin -d /usr/local/named -g named named [[email protected] ~]#chown -R named:named /usr/local/bind/
7.前台启动named服务,看看配置是否正常.
[[email protected] ~]#/usr/local/bind/sbin/named -c /usr/local/bind/etc/named.conf -f -g -u named