Learning NetBSD: Bind9
Posted on July 11th, 2005
Time for another adventure with pkg_add. This time it's slightly more interesting-- since bind9 is a service that will be run constantly rather than an ordinary program that gets run occasionally, there's a little bit more to the installation process.
Just like last time, it starts with a visit to the NetBSD Packages Collection. With the appropriate platform link in hand, back to the terminal, where as root we sally forth with:
metroplex# pkg_add
ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc-2005Q2/NetBSD-2.0/powerpc/\
All/bind-9.3.0pl1nb2.tgz
And here's the output:
ftp: connect to address 2001:4f8:4:7:2e0:81ff:fe21:6563: No route to
host
pkg_add: Package
`ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc-2005Q2/NetBSD-2.0/powerpc/\
All/bind-9.3.0pl1nb2.tgz'
OS mismatch:
pkg_add: NetBSD/powerpc 2.0_STABLE (pkg) vs. NetBSD/powerpc 2.0.2
(this host)
===========================================================================
The following files should be created for instmp.26571b:
/etc/rc.d/named9 (m=0755)
[/usr/pkg/share/examples/rc.d/named9]
/etc/rc.d/lwresd (m=0755)
[/usr/pkg/share/examples/rc.d/lwresd]
===========================================================================
===========================================================================
$NetBSD: MESSAGE,v 1.1 2005/03/18 01:14:32 tron Exp $
Please consider running BIND under the pseudo user account "named"
in a change root environment for security reasons.
To achieve this set the variable "named_chrootdir" in /etc/rc.conf to
the directory with the change root environment e.g
"/var/chroot/named".
===========================================================================
metroplex#
If you didn't have any idea what role /etc/rc.d served, this might be a bit confusing. Likewise if you're not familiar with the concept of a change root environment. But less the weird "instmp.26571b", the instructions are pretty straightforward. It's not to the point of flat-out telling you to copy the files under /usr/pkg/share/examples to /etc/rc.d, but on the other hand, why else would they have named the directory "examples"?
Once nice aspect of this installation experience is that you're notified of a simple change regarding an important feature. Coming into it, I didn't realize change root was something I'd have to consider; I figured it would be taken care of by the packager. Although it wasn't, it's only a minor speed bump of inconvenience. On Debian, by comparison, sometimes a particularly complex package will make certain assumptions for you (there's really no way of avoiding assumption if you want something as smooth-working as apt) and refer you to a documentation file after the fact. When you read the specified file, it won't necessarily be as introductory or explanatory as you might hope.
After copying the files into /etc/rc.d, I hit one snag:
metroplex# /etc/rc.d/named9 start /etc/rc.d/named9: WARNING: $named9 is not set properly - see rc.conf(5).
I met rc.conf during the installation process, so I knew it was the file that determined which services under /etc/rc.d were allowed to start. But man rc.conf mentioned named as an option. I was using named9. Things fell into place only when I had named9=YES in rc.conf. I suppose the moral of that story is, accept no substitutes when it comes to defining your startup scripts.
Now I suppose I ought to figure out how to configure bind9...