[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bind8 to Bind9



On Sat, 16 Nov 2002 15:19:02 -0500, Peter Billson <pete@elbnet.com>
wrote:
>  I am planning the move from Bind8 to Bind9 on woody and was wondering if anyone has any tips, gotchas or pointers I should know before the move.

Here is the script that I intend to use for bind8 to bind9 migration
(moving from a normal bind8 to a chroot-non-root bind9 in the
process). Use at your own risk, and keep a backup of your
configuration.

#!/bin/bash

set -v
set -e

cd /var/local/
mkdir bind
cd bind/
mkdir dev
cp -a /dev/random dev/
chmod 444 dev/random
mkdir -p usr/share/zoneinfo/Europe
cp -a /usr/share/zoneinfo/Europe/Berlin usr/share/zoneinfo/Europe/
mkdir -p var/cache/bind var/run/bind
adduser --ingroup nogroup --uid 130 --disabled-password --gecos
"bind,,," --shell /bin/false bind
chown bind:nogroup var/cache/bind var/run/bind
mkdir etc
cd etc/
ln -s /usr/share/zoneinfo/Europe/Berlin localtime
mv /etc/bind/ .
apt-get --download-only install bind9
dpkg --purge bind
apt-get install bind9
sleep 1
kill $(cat /var/run/named.pid)
rm -rf /etc/bind
ln -s /var/local/bind/etc/bind /etc/bind
rndc-confgen > bind/rndc.conf
echo '        pid-file "/var/run/bind/named.pid";' >
bind/rndc.addition
< bind/rndc.conf sed -n '/^# Use with the following/,/# End of
named.conf/{/^# U
se with the following/d;/^# End of named.conf/d;s/^# //;p;}' >>
bind/rndc.additi
on
jed bind/named.conf bind/rndc.addition
rm bind/rndc.addition
cat > /etc/default/bind9 <<"EOF"
CHROOT="/var/local/bind"
USER="bind"

OPTS=""
[ -n $USER ] && OPTS="$OPTS -u $USER"
[ -n $CHROOT ] && OPTS="$OPTS -t $CHROOT"
EOF
cat > /etc/init.d/bind9 <<"EOF"
#!/bin/sh

PATH=/sbin:/bin:/usr/sbin:/usr/bin


# for a chrooted server: "-u nobody -t /var/lib/named"
OPTS=""

test -f /etc/default/bind9 && . /etc/default/bind9

test -x /usr/sbin/named || exit 0

case "$1" in
    start)
        echo -n "Starting domain name service: named"
        start-stop-daemon --start --quiet \
            --pidfile /var/run/named.pid --exec /usr/sbin/named --
$OPTS
        echo "."        
    ;;

    stop)
        echo -n "Stopping domain name service: named"
        /usr/sbin/rndc stop
        echo "."        
    ;;

    reload)
        /usr/sbin/rndc reload
    ;;

    restart|force-reload)
        $0 stop
        sleep 2
        $0 start
    ;;
    
    *)
        echo "Usage: /etc/init.d/bind
{start|stop|reload|restart|force-reload}" >&2
        exit 1
    ;;
esac

exit 0
EOF
/etc/init.d/bind9 start


The script will drop you into an editor, asking you to manually
incorporate a "pidfile" line, and the rndc configuration into
named.conf.

Be aware that you will be without name service for the run time of the
script.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29



Reply to: