
Installing software via a ports (or package source) tree in FreeBSD
How to Install a software via a ports (or package source) tree ? This following article are steps, notes and examples for installing BIND 8 via the OpenBSD 2.8 ports tree.
1) Check for current version
I assume you already have a recent OpenBSD 2.8 ports tree installed under /usr/ports/.
The /usr/ports/net/bind8/Makefile should be using bind-8.2.3. BIND8 was updated
a few months ago due to a security issue. In addition, the BIND8 from OpenBSD
ports has had some auditing.
Run "ident /usr/ports/net/bind8/Makefile". The Makefile
should be version "1.19.2.2" (or "1.22" if using -current);
for example:
$ ident /usr/ports/net/bind8/Makefile
/usr/ports/net/bind8/Makefile:
$OpenBSD: Makefile,v 1.19.2.2 2001/03/01 12:55:31 naddy Exp $
If you used CVS, you can find out if you are using 2.8 stable, for example:
$ cat /usr/ports/net/bind8/CVS/Tag
TOPENBSD_2_8
2) Install from ports
Go into the directory "cd /usr/ports/net/bind8".
Become the superuser (or use sudo to run commands).
Run "make". This will download
bind-openbsd-8.2.3-20010129.tar.gz (the partially-audited BIND8 version),
extract and start the compilation.
Then wait for it to build.
3) Install
The "make" should finish successfully. It should end with something
like:
===> named-bootconf
rm -f named-bootconf
cp named-bootconf.sh named-bootconf
nroff -Tascii -mandoc named-bootconf.8 > named-bootconf.cat8
===> nsupdate
cc -O2 -I/usr/ports/net/bind8/work/named/nsupdate/../include
-nostdinc -idirafter /usr/include -c nsupdate.c
cc -o nsupdate -nostdlib -L/usr/lib /usr/lib/crt0.o nsupdate.o
/usr/ports/net/bind8/work/named/nsupdate/../libbind/libbind.a -lgcc -lc
-lgcc
nroff -Tascii -mandoc nsupdate.8 > nsupdate.cat8
===> doc
===> doc/html
Please note that the installation of BIND 8 will replace the current BIND 4
programs.
As the "root" superuser (or use "sudo"), run the
following:
make install
This will run the installation scripts that prepare your chroot'ed environment
and copy and install the needed files and programs.
This will also make a "bind-8.2.3.tgz" package which can be copied
and used on other OpenBSD 2.8 systems. (It should be located at /usr/ports/packages/i386/All/bind-8.2.3.tgz.)
This install will also replace your existing BIND utilities. It will back
them up first; for example if you need BIND 4's ndc then use "/usr/sbin/ndc-0".
4) Basic configuration
You will need to configure your named.conf file. The default chroot directory is
located at /var/named. The default config file is /var/named/named.conf.
You can find some sample BIND 8 configurations in your /usr/local/share/examples/bind8
directory.
To use these samples to get started do:
(The following two lines is one command.)
cp -i /usr/local/share/examples/bind8/named.{conf,localhost,loopback,root}
/var/named/.
chown root:named /var/named/named.conf
chmod 640 /var/named/named.conf
5) Start named
Then enable named at boot time, edit your /etc/rc.conf file. It should contain:
named_flags=""
named_user=named
named_chroot=/var/named
By default, named_flags is set to "NO"; so it needs to be changed.
It easiest to start "named" at boot time. But if you really need to
start it without rebooting try:
kill `cat /var/run/syslog.pid`
syslogd -a /var/named/dev/log
(cd /dev ; pax -rw -pe null /var/named/dev )
cp -p /etc/localtime /var/named/etc/localtime
named -t /var/named -u named
6) Check named
First make sure it is running by running:
ps auxwww | grep named
You should receive something like:
root 13033 1.8 1.2 148 476 p0 S+ 6:54PM 0:00.08 grep
named
root 26514 0.0 1.3 96 524 ?? Ss 6:50PM 0:00.12 syslogd
-a /var/named/dev/log
named 6285 0.0 1.9 1528 760 ?? Ss 6:53PM 0:00.12 named
-t /var/named -u named
Then run:
grep named /var/log/messages
And it should result with:
Mar 5 18:53:37 k3 named[2565]: starting (/named.conf). named 8.2.3-REL
Mon Mar 5 17:43:43 PST 2001 root@k3:/usr/ports/net/bind8/work/named/named
Mar 5 18:53:41 k3 named[6285]: Ready to answer queries.
More details info can be found by running:
grep named /var/log/daemon
With results similar to:
Mar 5 18:53:37 k3 named[2565]: starting (/named.conf). named 8.2.3-REL
Mon Mar 5 17:43:43 PST 2001
root@k3:/usr/ports/net/bind8/work/named/named
Mar 5 18:53:40 k3 named[2565]: master zone "localhost" (IN) loaded
(serial 1999061400)
Mar 5 18:53:40 k3 named[2565]: master zone
"0.0.127.in-addr.arpa" (IN) loaded (serial 1999061400)
Mar 5 18:53:40 k3 named[2565]: hint zone "" (IN) loaded (serial 0)
Mar 5 18:53:41 k3 named[2565]: listening on [127.0.0.1].53 (lo0)
Mar 5 18:53:41 k3 named[2565]: listening on [192.168.0.6].53 (we1)
Mar 5 18:53:41 k3 named[2565]: Forwarding source address is
[0.0.0.0].22567
Mar 5 18:53:41 k3 named[6285]: chrooted to /var/named
Mar 5 18:53:41 k3 named[6285]: group = 70
Mar 5 18:53:41 k3 named[6285]: user = named
Mar 5 18:53:41 k3 named[6285]: Ready to answer queries
You can receive even more information by doing:
ndc status
7) Further configuration
Add your local DNS IP to your /etc/resolv.conf.
For example, it could have:
nameserver 127.0.0.1
nameserver 192.168.0.1 <--- this is an outside nameserver
lookup file bind
Then use nslookup (and/or "dig") to test some more; for example:
$ nslookup bsdtoday.com
Server: localhost
Address: 127.0.0.1
Name: bsdtoday.com
Address: 63.236.73.26
8) Finish up
You can clean up your BIND 8 ports tree by doing:
cd /usr/ports/net/bind8
make clean
|