DNS (4)-DNS compilation and Installation

Source: Internet
Author: User

Labels: local software compiled DNS bind named

Bind compilation and Installation

The software package with tar.gz and tar.bz2 is mostly through. /configure; Make; make install to install; some software directly make & make install, we can use. /configure -- help to view the functions of the configuration software. Most of the software is provided. /configure configures the software's functions. A few do not. If not, make & make install directly.

. One of the most important parameters of/configure is -- prefix. With the -- prefix parameter, we can specify the software installation directory. When we don't need this software, just delete the Software Directory.

For example, you can specify bind to install in the/usr/local/Bind directory:

[[Email protected] bind] #./configure -- prefix =/usr/local/Bind. If you do not need bind, you can directly Delete the/usr/local/Bind directory.

 

Next we will compile and install bind-9.5.tar.gz

1. Create a named system user, uid = 53. The named group, gid = 53, is automatically created. Because the groups in the DNS service file are all running in named.

# Useradd-r-u 53 named

 

2. Expand the compressed package, compile and install the package

# Tar xf bind-9.9.5.tar.gz

# Cd bind-9.9.5

#./Configure -- prefix =/usr/local/bind9 -- sysconfdir =/etc/named -- disable-ipv6 -- disable-chroot -- enable-threads

# Make & make install

Parameter Introduction: there are also many parameters. man./configure contains many parameters. You can take a look.

-- Prefix =/usr/local/bind9: Specifies the installation path.

-- Sysconfdir =/etc/named: place the created system configuration file in named.

-- Disable-ipv6: Do not start IPv6

-- Disable-chroot: do not enable the chroot Function

-- Enable-threads: Start the thread

 

3. Modify the PATH environment variable

 #vim /etc/profile.d/bind.sh

Add the environment variable,. Source bind. Sh, or open a new window, or restart it. You can see that the environment variable has been added with ECHO $ path.

650) This. width = 650; "Title =" 08h3t'3366d%uehj1jtw_20h1.jpg "src =" http://s3.51cto.com/wyfs02/M01/45/DD/wKiom1Psu0fi3sMDAABSttYFApg569.jpg "alt =" wkiom1psu0fi3smdaabsttyfapg569.jpg "/>

 

4. Export help manual

When viewing the help manual, # Man-M/usr/local/bind9/share/man/named

There is sometimes a problem:

Cannot open the message catalog "man" for locale "zh_CN.UTF-8"

(Nlspath = "/usr/share/locale/% L/lc_messages/% N ")

Solution: # cp/usr/share/locale/en/lc_messages/man/usr/share/locale/zh/lc_messages/

If you want to see the help documentation in the future, do not use the absolute path:

Edit the configuration file: # Add an absolute path to VIM/etc/man. config.

650) This. width = 650; "Title =" q] ~ R'9x9wjpi6tnp(i7%5g.jpg "src =" http://s3.51cto.com/wyfs02/M02/45/DF/wKioL1PsvfiB2o_3AADEFpmtA8M397.jpg "alt =" wkiol1psvfib2o_3aadefpmta8m397.jpg "/>

 

5. Provide the master configuration file/etc/named. conf.

650) This. width = 650; "Title =" 6rk'dsc9rn1_tbb72ox(_dm1_jpg "src =" http://s3.51cto.com/wyfs02/M02/45/DF/wKioL1PsvkPzxDW4AAFXTNIMiIo097.jpg "alt =" wkiol1psvkpzxdw4aafxtnimiio097.jpg "/>

 #chown root:named named.conf  #chmod 640 named.conf

Provides a regional DNS library for the root and localhost.

 #mkdir /var/named/slaves –pv #chown root:named /var/named #chown named:named /var/named/slaves/ #chmod 750 /var/named #chmod 770 /var/named/slaves/

Localhost. Zone

650) This. width = 650; "Title ="} 4whrvkb ~ 'Pn{@_hn5l81_hy.jpg "src =" http://s3.51cto.com/wyfs02/M01/45/DE/wKiom1PsvjexSp5nAACBh1xQswg757.jpg "alt =" wkiom1psvjexsp5naacbh1xqswg757.jpg "/>

127.0.0.in-ADDR. ARPA

650) This. width = 650; "Title =" p0000uqgbc9%n0rxz%o9%f_m4v.jpg "src =" http://s3.51cto.com/wyfs02/M02/45/DF/wKioL1Psv4vxHITbAACGtcdQQqI025.jpg "alt =" wkiol1psv4vxhitbaacgtcdqqqi025.jpg "/>

 #chown :named localhost.zone #chown :named 127.0.0.zone

Create named. ca

Create named. Ca in the/var/named directory and copy the following

;       This file holds the information on root name servers needed to;       initialize cache of Internet domain name servers;       (e.g. reference this file in the "cache  .  <file>";       configuration file of BIND domain name servers).;;       This file is made available by InterNIC ;       under anonymous FTP as;           file                /domain/named.cache;           on server           FTP.INTERNIC.NET;       -OR-                    RS.INTERNIC.NET;;       last update:    June 2, 2014;       related version of root zone:   2014060201;; formerly NS.INTERNIC.NET;.                        3600000  IN  NS    A.ROOT-SERVERS.NET.A.ROOT-SERVERS.NET.      3600000      A     198.41.0.4A.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:BA3E::2:30;; FORMERLY NS1.ISI.EDU;.                        3600000      NS    B.ROOT-SERVERS.NET.B.ROOT-SERVERS.NET.      3600000      A     192.228.79.201B.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:84::B;; FORMERLY C.PSI.NET;.                        3600000      NS    C.ROOT-SERVERS.NET.C.ROOT-SERVERS.NET.      3600000      A     192.33.4.12C.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2::C;; FORMERLY TERP.UMD.EDU;.                        3600000      NS    D.ROOT-SERVERS.NET.D.ROOT-SERVERS.NET.      3600000      A     199.7.91.13D.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2D::D;; FORMERLY NS.NASA.GOV;.                        3600000      NS    E.ROOT-SERVERS.NET.E.ROOT-SERVERS.NET.      3600000      A     192.203.230.10;; FORMERLY NS.ISC.ORG;.                        3600000      NS    F.ROOT-SERVERS.NET.F.ROOT-SERVERS.NET.      3600000      A     192.5.5.241F.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:2F::F;; FORMERLY NS.NIC.DDN.MIL;.                        3600000      NS    G.ROOT-SERVERS.NET.G.ROOT-SERVERS.NET.      3600000      A     192.112.36.4;; FORMERLY AOS.ARL.ARMY.MIL;.                        3600000      NS    H.ROOT-SERVERS.NET.H.ROOT-SERVERS.NET.      3600000      A     128.63.2.53H.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:1::803F:235;; FORMERLY NIC.NORDU.NET;.                        3600000      NS    I.ROOT-SERVERS.NET.I.ROOT-SERVERS.NET.      3600000      A     192.36.148.17I.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FE::53;; OPERATED BY VERISIGN, INC.;.                        3600000      NS    J.ROOT-SERVERS.NET.J.ROOT-SERVERS.NET.      3600000      A     192.58.128.30J.ROOT-SERVERS.NET.      3600000      AAAA  2001:503:C27::2:30;; OPERATED BY RIPE NCC;.                        3600000      NS    K.ROOT-SERVERS.NET.K.ROOT-SERVERS.NET.      3600000      A     193.0.14.129K.ROOT-SERVERS.NET.      3600000      AAAA  2001:7FD::1;; OPERATED BY ICANN;.                        3600000      NS    L.ROOT-SERVERS.NET.L.ROOT-SERVERS.NET.      3600000      A     199.7.83.42L.ROOT-SERVERS.NET.      3600000      AAAA  2001:500:3::42;; OPERATED BY WIDE;.                        3600000      NS    M.ROOT-SERVERS.NET.M.ROOT-SERVERS.NET.      3600000      A     202.12.27.33M.ROOT-SERVERS.NET.      3600000      AAAA  2001:DC3::35; End of File

 

6. Try to start the cache Name Server

# Named-checkconfig # named-u named-C/etc/named. conf run on the backend. When named is started, port 53 is opened.

 

7. Provide rndc

 #rndc-confgen -r /dev/urandom > /etc/named/rndc.conf #chown root:named /etc/named/rndc.conf #chmod 440 /etc/named/rndc.conf

Copy the annotation information in rndc. conf to named. conf, and remove the annotation.

 key "rndc-key" {     algorithm hmac-md5;     secret "ji71N+eDfn8txV9fIlGMEw==";  };  controls {     inet 127.0.0.1 port 953     allow { 127.0.0.1; } keys { "rndc-key"; };  };

Kill the named process with kissall-hup named. after starting the process, rndc can be used. If an error persists, check the permission. If the permission is correct, restart the system, I can't see the error after checking it for a long time, but rndc cannot be started. I can restart the system. The specific cause is unknown.

650) This. width = 650; "Title =" 94252447vp%m7%%8_4o82w%m9.jpg "src =" http://s3.51cto.com/wyfs02/M00/45/DE/wKiom1Pswa3DUUZbAAG07r7nec8661.jpg "alt =" wkiom1pswa3duuzbaag07r7nec8661.jpg "/>

 

8. Provide scripts

# Vim/etc/init. d/named

Add the following script

#!/bin/bash## description: named daemon# chkconfig: - 25 80#                                 pidFile=/usr/local/bind9/var/run/named.pidlockFile=/var/lock/subsys/namedconfFile=/etc/named/named.conf[ -r /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions start() {    if [ -e $lockFile ]; then        echo "named is already running..."        exit 0    fi     echo -n "Starting named:"    daemon --pidfile "$pidFile" /usr/local/bind9/sbin/named -u named -c "$confFile"    RETVAL=$?    echo     if [ $RETVAL -eq 0 ]; then        touch $lockFile        return $RETVAL    else        rm -f $lockFile $pidFile        return 1    fi} stop() {    if [ ! -e $lockFile ]; then        echo "named is stopped."        #exit 0    fi     echo -n "Stopping named:"    killproc named    RETVAL=$?    echo     if [ $RETVAL -eq 0 ];then        rm -f $lockFile $pidFile        return 0    else        echo "Cannot stop named."        failure        return 1    fi} restart() {    stop    sleep 2    start} reload() {    echo -n "Reloading named: "    killproc named -HUP    #killall -HUP named    RETVAL=$?    echo     return $RETVAL} status() {    if pidof named &> /dev/null; then        echo -n "named is running..."        success        echo    else        echo -n "named is stopped..."        success        echo    fi} usage() {    echo "Usage: named {start|stop|restart|status|reload}"} case $1 instart)    start ;;stop)    stop ;;restart)     restart ;;status)    status ;;reload)    reload ;;*)    usage     exit 4     ;;           esac

By now, you can start the service and complete the compilation.

650) This. width = 650; "Title =" ay_assist_wk0kftq1_um2yn879eo.jpg "src =" http://s3.51cto.com/wyfs02/M02/45/E0/wKioL1PsxsLjcgJJAABmI_o7-yc299.jpg "alt =" wKioL1PsxsLjcgJJAABmI_o7-yc299.jpg "/>

 

This article from the fish blog, please be sure to keep this source http://kyfish.blog.51cto.com/1570421/1540201

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.