linux安裝bind

來源:互聯網
上載者:User

標籤:

https://www.isc.org/downloads/

2、解壓tar zxvf bind-9.9.7rc1.tar.gz 

cd bind-9.9.7rc1

3、編譯安裝

 

./configure --prefix=/usr/local/named --enable-threads #--enable-threads

 

提示沒有openssl

checking for OpenSSL library... configure: error: OpenSSL was not found in any of /usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw; use --with-openssl=/path

--------------------------------------------------------------------------------------------------

提示沒有OpenSSL

解決方案:

yum install openssl

 yum install openssl-devel

【 ubuntu系統解決方案 apt-get install openssl  apt-get install libssl-dev】

 

【sudo ./rndc-confgen > rndc.conf 反應很久】

----------------------------

解決方案:

http://www.nginxs.com/linux/43.html

 

【/home/wkubuntu/named/sbin/named  -c /home/wkubuntu/named/etc/named.conf  & 按兩次,沒有出現 done 】

---------------------------

cd /home/wkubuntu/named/etc

vi named.conf  修改一下這個檔案。。把上面copyright 去掉

-----------------------------------------------------------------------------------------------------------------------------------------------

2015年2月4日

1、sudo wget ftp://ftp.isc.org/isc/bind9/9.10.1/bind-9.10.1.tar.gz

2、tar -zxvf bind-9.10.1.tar.gz 

3、建立目錄

在/home/wkubuntu下建立named目錄和namedfile目錄

4、編譯安裝

cd bind-9.10.1

 ./configure --prefix=/home/wkubuntu/named/ --with-dlz-mysql=/usr/local/mysql

make

make install

此時進入/home/wkubuntu/named目錄,裡面自動產生了bin  etc  include  lib  sbin  share  var這些檔案目錄

5、配置bind

cd /home/wkubuntu/named/etc

touch named.conf

vi named.conf張貼內容1

在/home/wkubuntu/named/var 目錄下拷貝那5個檔案

產生rndc的key

a)cd /home/wkubuntu/named/sbin/

b)vim random 輸入很長一段字母。就是伺服器上沒有random產生器,這種情況下我們就手動偽造一個檔案代替/dev/random的功能

c)rndc-confgen -r random > /etc/rndc.key

d)cat /etc/rndc.key 

e)拷貝

 secret "pfNOQ0fENSBBGBYn/ndRsw=="; 這一行

覆蓋/home/wkubuntu/named/etc 的named.conf對應的那一行

 

 

6、啟動bind ,列印進程

輸入兩次sudo /home/wkubuntu/named/sbin/named  -c /home/wkubuntu/named/etc/named.conf  & 

出現done 就代表成功了

【如果出現了exit,出錯了,看列印進程sudo /home/wkubuntu/named/sbin/named  -gc /home/wkubuntu/named/etc/named.conf  & 

killall named 可以關閉掉所有named,如果用了-gc的話】

 要建立一個log目錄,如下的配置 mkdir logs

/home/wkubuntu/named/logs

其他:

內容1:

logging{channel error_log {    file "/home/wkubuntu/named/logs/normal.log" versions 3 size 2m;    severity error;    print-time yes;    print-severity yes;    print-category yes;};category default{    error_log; };channel update_log{    file "/home/wkubuntu/named/logs/update.log" versions 3 size 1m;    severity info;    print-time yes;    print-severity yes;    print-category yes;};category update{    update_log;};channel notify_log{    file "/home/wkubuntu/named/logs/notify.log" versions 3 size 1m;    severity info;    print-time yes;    print-severity yes;    print-category yes;};category notify{    notify_log;};};options {        directory "/home/wkubuntu/named/var/";           pid-file "/home/wkubuntu/named/var/run/named/named.pid";        dump-file "/home/wkubuntu/named/logs/named_dump.db";        statistics-file "/home/wkubuntu/named/logs/named.stats";        version "Welcome to NIOT platform!";        listen-on-v6 { any; };        allow-query { any; };        allow-query-cache { any; };        allow-recursion { localnets; localhost; };        notify no;};key "rndc-key" {     algorithm hmac-md5;     secret "fLDVvLVXFjMJpdiy+7nESw==";};controls {     inet 127.0.0.1 port 953    allow { 127.0.0.1; } keys { "rndc-key"; };};zone "." IN {    type hint;    file "/home/wkubuntu/named/var/named.root";};zone "localhost" IN {    type master;    file "/home/wkubuntu/named/var/localhost.zone";    allow-update { none; };};zone "0.0.127.in-addr.arpa" IN {    type master;    file "/home/wkubuntu/named/var/localhost.reverse";    allow-update { none; };};dlz "Mysql zone" {     database "mysql     {host=127.0.0.1 dbname=db_epp  ssl=false port=3306 user=root pass=root}     {select zone from dns_records where zone = ‘$zone$‘ limit 1}     {select ttl, type, mx_priority,     case         when lower(type) = ‘txt‘ then concat(‘\"‘, data, ‘\"‘)         when lower(type) = ‘soa‘ then concat_ws(‘ ‘, data, resp_person, serial, refresh, retry, expire, minimum)         when lower(type) = ‘naptr‘ then concat(‘ ‘, naptr_order, ‘ ‘, naptr_preference, ‘ \"‘, naptr_flags, ‘\"‘, ‘ \"‘, naptr_service, ‘\"‘, ‘ \"‘, naptr_regexp,‘\" ‘, data, ‘.‘)         else data     end     from dns_records where zone = ‘$zone$‘ and host = ‘$record$‘}";};

 7、測試

dig @localhost 6920000000012.running.niot.cn naptr

資料庫裡面要有這條記錄,如上測試即可

linux安裝bind

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.