Todd Smith Org

April 28, 2009

Compile Bind 9 on Ubuntu / Debian

Filed under: Server Technology,Unix Administration,Web Hosting — admin @ 1:09 pm

Quick, and dirty:

apt-get install libssl-dev
wget http://ftp.isc.org/isc/bind9/9.6.0-P1/bind-9.6.0-P1.tar.gz
./configure --prefix=/opt/bind9 --with-openssl=yes --sysconfdir=/etc/bind --with-randomdev=/dev/urandom
make && make install

Setup the named.conf, options, loggin, and zones

named.conf

include "/etc/bind/named.logging";

include "/etc/bind/named.options";



        zone "." {
                type hint;
                file "root.cache";
        };



include "/etc/bind/named.master";

include "/etc/bind/named.reverse";

named.logging

logging {
        channel "querylog" {
          file "/var/log/query.log";
          print-time yes;
        };
        channel default_log {
          file "/var/log/named.log";
          print-time yes;
        };
        category queries { querylog; };
        category default { default_log; default_debug; };
        category lame-servers { null; };
};

named.options

acl "toddsmithorg_networks"  { 23.35.27.1/25; };
acl "client_networks" { 192.198.140.0/25; };
options {
        directory "/var/named";
        pid-file "/var/run/named.pid";
        allow-recursion { toddsmithorg_networks; client_networks; };
        version "no thankyou";
        notify no;
        listen-on port 53 {
                127.0.0.1;
                23.35.27.10;
        };
        allow-transfer {
                23.35.27.11;
        };
};

named.master

zone "toddsmith.org" IN {
        type master;
        file "toddsmith.org";
};

Setup your init script

#! /bin/sh

NAMED_ROOT="/opt/bind9"

case "$1" in
    start)
        echo -n "Starting named... "
        $NAMED_ROOT/sbin/named -u named -c /etc/bind/named.conf && echo OK
        ;;
    stop)
        echo -n "Stopping named... "
        kill -15 `cat /var/run/named.pid` && echo OK
        ;;
    restart|reload)
        $0 stop  &&  $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|reload}"
        exit 1
esac
exit 0

This should get you started

4 Comments »

  1. Hi, nice posts there :-) hold responsible’s for the interesting information

    Comment by SedeAchiedy — May 24, 2009 @ 12:43 pm

  2. Dear Sede,

    This information is from years of my own experience compiling, configuring, and installing bind.

    Thanks for your comment.

    Comment by admin — May 26, 2009 @ 6:59 am

  3. hi i want to know did you have to create all these file in /etc/bind

    please i need help

    i get this
    root@peace:/etc# cd b
    bash.bashrc bind/ blkid.conf bogofilter.cf brltty/
    bash_completion bind.keys blkid.tab bonobo-activation/ brltty.conf
    bash_completion.d/ bindresvport.blacklist bluetooth/ brlapi.key byobu/
    root@peace:/etc# cd bind
    root@peace:/etc/bind# ls -l
    total 4
    -rw-r–r– 1 root root 601 2010-02-21 21:08 bind.keys
    root@peace:/etc/bind#

    now when i do find . -name named.conf -print
    ./usr/src/bind-9.7.0/bin/tests/system/nsupdate/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/nsupdate/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/forward/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/forward/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/forward/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/forward/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/pending/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/pending/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/pending/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/pending/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/masterformat/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/masterformat/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/autosign/ns5/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/autosign/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/autosign/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/autosign/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/autosign/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/sortlist/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stub/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stub/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stub/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stress/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stress/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stress/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/stress/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/resolver/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/unknown/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/glue/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/limits/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/tsig/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/v6synth/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/v6synth/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/v6synth/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dialup/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dialup/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dialup/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/upforwd/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/upforwd/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/upforwd/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns5/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns7/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns6/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dnssec/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/checknames/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/checknames/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/checknames/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/cacheclean/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/cacheclean/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/xfer/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/xfer/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/xfer/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/masterfile/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/views/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/notify/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/notify/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/notify/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/xferquota/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/xferquota/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/rrsetorder/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/rrsetorder/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/rrsetorder/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/lwresd/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dlv/ns5/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dlv/ns4/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dlv/ns3/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dlv/ns1/named.conf
    ./usr/src/bind-9.7.0/bin/tests/system/dlv/ns2/named.conf
    ./usr/src/bind-9.7.0/bin/tests/named.conf
    ./usr/src/bind-9.7.0/contrib/zkt/examples/flat/named.conf
    ./usr/src/bind-9.7.0/contrib/zkt/examples/hierarchical/named.conf
    ./usr/src/bind-9.7.0/contrib/zkt/examples/views/named.conf

    what i did wrong here

    Where i be using this server is for learning and for hobby of Linux
    well my first opinion is to create a webserver for production with iptable,Apache,and for personal learnig

    i need some help to get those working
    as well as after learning something and like to share it with other’s that looking for help …
    thanks mike i like you tut i bought on centos but this one is debian base on ubuntu is diferent i have already compile my own kernel and apache mysql php as well now it’s just looking forwarde to make dns server work then i can host a website on it…..
    well it’s i can’t get a god tut to complete this
    Thanks Mike

    Comment by peacengell — March 11, 2010 @ 1:59 am

  4. Dear Mike,

    You’ll have to create the following files in the /etc/bind

    named.logging
    named.master
    named.options
    named.conf

    That should get you on the right track.

    Comment by admin — March 12, 2010 @ 11:11 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress