1. 程式人生 > >Bind-DLZ with MySQL

Bind-DLZ with MySQL

word path 遠程 zxvf 地址 包安裝 -m random 相關

系統環境:

系統: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.驗證是否安裝成功

[root@localhost ~]# rpm -qi mysql-server

4.啟動MySql服務

[root@localhost ~]# /etc/init.d/mysqld start

5.登錄並設置密碼

[root@localhost ~]# 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.設置開機啟動(非必須)

[root@localhost ~]#chkconfig mysqld on

二、下載並安裝Bind-DLZ

1.下載並解壓Bind-DLZ軟件包

[root@localhost opt]#wget ftp://ftp.isc.org/isc/bind9/9.11.0-P2/bind-9.11.0-P2.tar.gz
[root@localhost opt]#tar -zxvf bind-9.11
.0-P2.tar.gz

2.在64位系統上編譯,您可能需要設置一些變量,以便找到適當的mysql庫:

[root@localhost ~]# export CPPFLAGS="-I/usr/lib64/mysql $CPPFLAGS"
[root@localhost ~]# export LDFLAGS="-L/usr/lib64/mysql $LDFLAGS"
[root@localhost ~]# export LD_LIBRARY_PATH="/usr/lib64/mysql"

3.編譯安裝Bind-DLZ.

[root@localhost opt]# cd bind-9.11.0-P2
[root@localhost bind-9.11.0-P2]#./configure --prefix=/usr/local/bind  --enable-threads --enable-largefile --disable-ipv6 --disable-openssl-version-check --with-dlz-mysql=yes
[root@localhost bind-9.11.0-P2]# make
[root@localhost bind-9.11.0-P2]# make install

4.查看版本並測試軟件是否安裝成功

[root@localhost 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:

[root@localhost ~]# cd /usr/local/bind/etc/
[root@localhost etc]# rndc-confgen -r /dev/urandom > rndc.conf

提供ca文件

[root@localhost etc]#wget -O named.ca  http://www.internic.net/domain/named.root

創建並生成named.conf

[root@localhost etc]#  tail -10 rndc.conf | head -9 | sed s/#\ //g > named.conf

生產的named.conf文件只key和controls部分,需要自己手動添加logging和options部分,完整文件如下:

[root@localhost 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用戶運行,

[root@localhost ~]#groupadd -r -g 25 named
[root@localhost ~]#useradd -r -u 25 -s /bin/nologin -d /usr/local/named -g named named
[root@localhost ~]#chown -R named:named /usr/local/bind/

7.前臺啟動named服務,看看配置是否正常.

[root@localhost ~]#/usr/local/bind/sbin/named -c /usr/local/bind/etc/named.conf -f -g -u named

  

  

  

  

  

  

Bind-DLZ with MySQL