starting bind

Simon Waters Simon at wretched.demon.co.uk
Mon Nov 25 19:09:14 UTC 2002


Cricket Liu wrote:
> 
> Stand H wrote:
> > I usually set up programs with rpm. I install new Red
> > Hat 7.2 without bind and try to install bind 9 by
> > running these commands:
> > $./configure
> > $make
> > $make install
> > I didnt see error message but I dont know how to start
> > it. I could not start by using $service named start as
> > I used to do with installed service by using rpm.
> 
> You can start it just by running the named executable.  For
> example:
> 
> # /usr/sbin/named

Built from source on Linux it will put executables in
/usr/local/bin and /usr/local/sbin I think.

> But first you need to create a named.conf file, probably in
> /etc, for named to read.

On my Redhat boxes with BIND 9 source install, I added a user
"named" with home directory /home/named, and put config files
there. Then I use the following /etc/init.d/named file (the old
one will need backing up). It also assumed rndc has been set up
correctly, and chroots named to the home directory.

Use the script at your own risk, it is probably better to
plaguarise the existing Redhat script if you have mastered the
"functions" RedHat uses for starting daemons, but I hadn't when
I wrote this. You'll want relevant symbolic links to ensure it
starts on booting.

I also have a script for setting up a caching DNS server on
Linux and Solaris with BIND 9 built and installed from source
which I'll try and dig out if you mail me off list. It isn't
beautiful but it is a good start. I ought to polish it up and
add it to my website.

cat /etc/init.d/named
#!/bin/sh
#
# Generic Unix start up script for named daemon
# Simon Waters 2000-06-06
# Copyright Eighth Layer Limited.
#
# This script may want further customisation to support Unix
variants
#
[ -f /usr/local/sbin/named ] || exit 0

[ -f /home/named/named.conf ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        echo -n "Starting named: "
        /usr/local/sbin/named -u named -t /home/named -c
/named.conf
                RETVAL=$?
                [ $RETVAL -ne 0 ] && logger -p daemon.emerg
"named daemon failed
 to start"
        ;;
  stop)
        # Stop daemons.
        echo -n "Shutting down named: "
                /usr/local/sbin/rndc stop
                RETVAL=$?
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  reload)
        /usr/local/sbin/rndc reload
        RETVAL=$?
        ;;
  *)
        echo "Usage: named {start|stop|status|restart|reload}"
        RETVAL=1
esac
 
exit $RETVAL


More information about the bind-users mailing list