Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7 install bind9.12

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Reference 1: https://blog.51cto.com/sw5720/1611777

Reference 2: https://blog.csdn.net/orapeasant/article/details/1801395

Reference 3: http://www.linuxfromscratch.org/blfs/view/stable/server/bind.html

1. Download the latest bind software and use bind-9.12.1.tar.gz this time

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

2. Decompress to / root

Tar-zxvf bind-9.10.1-P1.tar.gz

3. Enter the decompressed folder

Cd bind-9.10.1-P1

4. Install necessary plug-ins such as openssl.

Yum install gcc gcc-c++ openssl openssl-dev*

5. Set parameters such as installation path, compile and install

The following command parameters are: specify path multithreading function large files support DNSSEC support

Set the installation path to / usr/local/named, multithreading, large file support, DNSSEC support

#. / configure-- prefix=/usr/local/named-- enable-threads-- enable-largefile-- with-tuning=large-- with-openssl creates a dedicated service account named, and local login is prohibited

# useradd-d / usr/local/named-s / sbin/nologin named compilation

# make installation

# make install enters the configuration folder after installation

# cd / usr/local/named/etc generate rndc.conf file

# / usr/local/named/sbin/rndc-confgen > rndc.conf Import rndc.conf content into named.conf

# tail-10 rndc.conf | head-9 | sed named.conf #\ / / g > edit the main configuration file

# vim named.conf

Options {

Listen-on port 53 {127.0.0.1;}

Directory "/ usr/local/named/var"; / / absolute path where domain name files are stored

Pid-file "named.pid"

Recursion yes

Allow-query {any;}

Recursive-clients 30000

Query-source.; / / if the address to be resolved cannot be found, other domain name servers will be queried.

Notify-source.; / / use the local source address and optional UDP port to send NOTIFY messages

}

Logging {

Channel query_log {/ / query log

File "/ var/log/named/query.log" versions 20 size 300m

Severity info

Print-time yes

Print-category yes

}

Channel error_log {/ / error log

File "/ var/log/named/error.log" versions 3 size 10m

Severity info

Print-time yes

Print-severity yes

Print-category yes

}

Category queries {query_log;}

Category default {error_log;}

}

Zone "." IN {

Type hint

File "named.root"; / / stored in / / usr/local/named/var directory

}

Zone "localhost" IN {

Type master

File "localhost.zone"

Allow-update {none;}

}

Zone "0.0.127.in-addr.arpa" IN {

Type master

File "named.local"

Allow-update {none;}

}; generate root server files

# cd / usr/local/named/var

# dig @ a.root-servers.net. Ns > named.root to create a local domain file

# vim localhost.zone

$TTL 86400

$ORIGIN localhost.

@ 1D IN SOA @ root (

42; serial (d. Adams)

3H; refresh

15m; retry

1W; expiry

1D); minimum

1D IN NS @

1D IN A 127.0.0.1

# vim named.local

$TTL 86400

@ IN SOA localhost. Root.localhost. (

1997022700; Serial

28800; Refresh

14400; Retry

3600000; Expire

86400); Minimum

IN NS localhost.

1 IN PTR localhost. Create a service start and stop script

# vi / etc/rc.d/init.d/named / / Service start and stop script

#! / bin/bashnamed a network name service. # chkconfig: 345 35 75 # description: a name server if [`id-u`-ne 0] then echo-e "\ e [31mERROR:For bind to port 53 fi case must run as root.\ e [0m" exit 1 fi case "$1" in start) if [- x / usr/local/named/sbin/named] Then / usr/local/named/sbin/named-c / usr/local/named/etc/named.conf-u named & & echo. & & echo-e 'BIND9 server\ e [32m\ e [0m' fi;; stop) kill `cat / usr/local/named/var/ named.pid` & & echo. & & echo-e 'BIND9 server\ e [33mstopped\ e [0m';; restart) echo. Echo "Restart BIND9 server" $0 stop sleep 1 echo-n "." & & sleep 2 & & echo-n "." & & sleep 2 & & echo-n "." & & sleep 2 $0 start;; reload) / usr/local/named/sbin/rndc reload Status) / usr/local/named/sbin/rndc status;; *) echo "$0 start | stop | restart | reload | status";; esac change script file permissions

# chmod 755 / etc/rc.d/init.d/named added to service control

# chkconfig-- add named assigns permissions to named

# chown-R named.named / usr/local/named/ create a soft connection

# ln-s / usr/local/named/sbin/named / sbin create a log folder

# modify the permissions of mkdir / var/log/named/ log folder

# chown-R named.named / var/log/named/ debug mode test whether it starts properly

# named-g / / debug mode startup

Set the boot service to start automatically

# chkconfig named on & & service named start

For troubleshooting, refer to http://bbs.chinaunix.net/thread-4187966-1-1.html

View the log when you start an exception

Named-g

Tail-n 30 / var/log/messages

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report