Installing Bind9 with DLZ and MySQL backend on Ubuntu Jaunty (9.04)
This forum post got me started but I got stuck in various places and thought I'd summarize what worked for me. I'm not going to explain much but if you're going to work with Bind and DLZ you probably know what you're dealing with. I also won't go into configuring DLZ because that depends on your particular DB schema and there is sufficient documentation on the DLZ website.
We need MySQL of course:
root@foo:~# apt-get install mysql-serverMake a directory to hold the source package for bind9,
root@foo:~# mkdir -p /usr/local/src/bind9and change into it:
root@foo:~# cd /usr/local/src/bind9Bison and fakeroot are needed. Not sure if these are a build-time only dependencies.
root@foo:/usr/local/src/bind9# apt-get install fakeroot bisonMy sources.list was lacking a required deb-src entry:
root@foo:/usr/local/src/bind9# vim /etc/apt/sources.listMake sure the following deb-src line is present and active:
deb-src http://us.archive.ubuntu.com/ubuntu/ jaunty main
If you modified sources.list, update the package index.
root@foo:/usr/local/src/bind9# apt-get updateGet the build tools:
root@foo:/usr/local/src/bind9# apt-get install build-essentialGet the Bind9 source package:
root@foo:/usr/local/src/bind9# apt-get source bind9This is what you should get:
root@foo:/usr/local/src/bind9# ls -1
bind9-9.5.1.dfsg.P2
bind9_9.5.1.dfsg.P2-1.diff.gz
bind9_9.5.1.dfsg.P2-1.dsc
bind9_9.5.1.dfsg.P2.orig.tar.gzWe also need the MySQL client headers when building Bind9 with DLZ and MySQL:
root@foo:/usr/local/src/bind9# apt-get install libmysqlclient15-devCd into the unpacked source tree:
root@foo:/usr/local/src/bind9# cd bind9-9.5.1.dfsg.P2/Modify the Debian build script:
root@foo:/usr/local/src/bind9/bind9-9.5.1.dfsg.P2# vim debian/rulesChange --with-dlz-mysql=no to --with-dlz-mysql=yes or add a line --with-dlz-mysql=yes (don't forget preceding backslash).
Install more build-time requirements. I didn't find out that I needed these until the dpkg-buildpackage step below complained about them being missing.
root@foo:/usr/local/src/bind9/bind9-9.5.1.dfsg.P2# apt-get install \
libkrb5-dev \
libkrb5-dev \
libssl-dev \
libtool \
libdb-dev \
libldap2-dev \
libldap2-dev \
libcap2-dev \
hardening-wrapper \
debhelper \
libxml2-devBuild the binary packages. If dpkg-buildpackage complains about unmet dependencies, apt-get install what's missing, rinse and repeat.
root@foo:/usr/local/src/bind9/bind9-9.5.1.dfsg.P2# dpkg-buildpackage -rfakeroot -bBack out one directory.
root@foo:/usr/local/src/bind9/bind9-9.5.1.dfsg.P2# cd ..You should have roughly the following binary packages:
root@foo:/usr/local/src/bind9# ls -1
bind9-9.5.1.dfsg.P2
bind9_9.5.1.dfsg.P2-1_amd64.changes
bind9_9.5.1.dfsg.P2-1_amd64.deb
bind9_9.5.1.dfsg.P2-1.diff.gz
bind9_9.5.1.dfsg.P2-1.dsc
bind9_9.5.1.dfsg.P2.orig.tar.gz
bind9-doc_9.5.1.dfsg.P2-1_all.deb
bind9-host_9.5.1.dfsg.P2-1_amd64.deb
bind9utils_9.5.1.dfsg.P2-1_amd64.deb
dnsutils_9.5.1.dfsg.P2-1_amd64.deb
libbind9-40_9.5.1.dfsg.P2-1_amd64.deb
libbind-dev_9.5.1.dfsg.P2-1_amd64.deb
libdns45_9.5.1.dfsg.P2-1_amd64.deb
libisc45_9.5.1.dfsg.P2-1_amd64.deb
libisccc40_9.5.1.dfsg.P2-1_amd64.deb
libisccfg40_9.5.1.dfsg.P2-1_amd64.deb
liblwres40_9.5.1.dfsg.P2-1_amd64.deb
lwresd_9.5.1.dfsg.P2-1_amd64.deb
Install the binary packages on your system.
root@foo:/usr/local/src/bind9# dpkg -i *.debUpdate (12/30/2009)
I seem to be running into a problem connected with leaking or intermittedly dying connections to the MySQL server. Bind logs "mysql driver unable to return result set for findzone query" and eventually dies. This matches a problem description I found in a discussion on the DLZ mailing list with some interesting findings. I have not applied the suggested patch yet and am trying to fix the problem solely by forcing Bind to run in a single thread which has also been suggested in that thread.
root@foo:~# vim /etc/default/bind9Change OPTIONS to include -n 1:
OPTIONS="-u bind -n 1"
Update (01/01/2010)
The order in which the bind9 and mysql init scripts are started by default does not reflect the fact that there now is a dependency of Bind9 on MySQL. Rebooting the system will start bind before mysql which causes bind to exit. Changing the boot order of init scripts is a bit involved so bare with me.
root@foo:~# apt-get install insserv
Edit the mysql init scripts and remove the $named from the two lines beginning with # Should-Start: and # Should-Stop:
root@foo:~# vim /etc/init.d/mysql-ndb root@foo:~# vim /etc/init.d/mysql-ndb-mgm root@foo:~# vim /etc/init.d/mysql
Append mysql to the Should-Start and Should-Stop lines.
root@foo:~# vim /etc/init.d/bind9Run insserv to set up the necessary symlinks in /etc/rcX.d.
root@foo:~# insserv mysql root@foo:~# insserv bind9
Reboot to make sure everything is in order.