Appendix C. Compiling and Installing BIND on Linux

The versions of BIND shipped with most versions of Linux are fairly recent. Still, BIND 8.4.7 is the most current BIND release (at the time of this writing), and the ISC recommends that you upgrade to BIND 9. For those of you who can’t wait until your version of Linux updates to the latest version of BIND 8 or 9, this appendix will show you how to do it yourself.

Instructions for BIND 8

Compiling and installing the latest version of BIND 8 is easy. (Because the path to BIND 8 includes following the link bind-8, you will always get the latest version.) The following sections provide detailed instructions.

Get the Source Code

First, you must get the source code. There’s a copy on ftp.isc.org, available for anonymous FTP:

%cd /tmp
% ftp ftp.isc.org.
Connected to isrv4.pa.vix.com.
220 ProFTPD 1.2.0 Server (ISC FTP Server) [ftp.isc.org]
Name (ftp.isc.org.:user): ftp
331 Anonymous login ok, send your complete e-mail address as password.
Password:
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

Now you need to find the right file:

ftp >cd /isc/bind/src/cur/bind-8
250 CWD command successful.
ftp > binary
200 Type set to I.
ftp > get bind-src.tar.gz
local: bind-src.tar.gz remote: bind-src.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for bind-src.tar.gz (1600504 bytes).
226 Transfer complete.
1600504 bytes received in 23 seconds (56 Kbytes/s)
ftp > quit
221 Goodbye.

Unpack the Source Code

Now you have the compressed tar file that contains the BIND source. Just use the tar command to uncompress and untar it:

%tar -zxvf bind-src.tar.gz

(This assumes you have a version of tar that can handle compressed gzip‘ed files; if you don’t, you can get a new copy of tar via anonymous FTP from ftp.gnu.org in /gnu/tar/tar-1.15.tar.) This creates a src directory with several subdirectories, including bin, include, lib, and port. Here are the contents of these subdirectories:

bin

Source code for all BIND binaries, including named.

include

Copies of include files referenced by the BIND code. You should use these to build your nameserver instead of using those shipped with your system because they have been updated.

lib

Source code for libraries used by BIND.

port

Information BIND uses to customize compilation settings and compile-time options for various operating systems.

Use the Proper Compiler Settings

Before you can build everything, you need a C compiler. Nearly every version of Linux comes with gcc, the GNU C compiler, which works fine. If you need to get gcc, you can find information at http://www.gnu.org/software/gcc/gcc.html.

By default, BIND assumes that you’re using the GNU C compiler and various other GNUish utilities, such as flex and byacc. These are a standard part of most Linux development environments. If your version of Linux uses different programs, though, you’ll need to modify port/linux/Makefile.set. This file lets BIND know which programs to use.

Build Everything

Next, you compile everything from the top-level directory. First, run:

%make stdlinks

Then, run:

%make clean
% make depend

This removes any old object files you might have sitting around from previous compilation attempts and updates the Makefile dependencies. Then, compile the source code by running:

%make all

The source code should compile without any errors. Next, install the new named and named-xfer programs into /usr/sbin. You’ll need to become root to do this. Use the command:

#make install

Instructions for BIND 9

Here’s how to compile and install BIND 9 on your Linux host. (At the time of this writing, 9.3.2 is the latest version.)

Get the Source Code

As with BIND 8, you must get the source code first. And again, this requires FTP’ing to ftp.isc.org:

%cd /tmp
% ftp ftp.isc.org.
Connected to isrv4.pa.vix.com.
220 ProFTPD 1.2.1 Server (ISC FTP Server) [ftp.isc.org]
Name (ftp.isc.org.:user): ftp
331 Anonymous login ok, send your complete email address as your password.
Password:
230 Anonymous access granted, restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

Change to the right directory and get the file you need:

ftp>cd /isc/bind9
250 CWD command successful.

At this point, you should check to see what is the latest version available by doing a dir command. At the time of this writing, 9.3.2 is the latest version.

ftp>cd 9.3.2
250 CWD command successful.
ftp> get bind-9.3.2.tar.gz
local: bind-9.3.2.tar.gz remote: bind-9.3.2.tar.gz
200 PORT command successful.
150 Opening BINARY mode data connection for bind-9.3.2.tar.gz (4673603 bytes).
226 Transfer complete.
4673603 bytes received in 92.4 secs (35 Kbytes/sec)
ftp> quit
221 Goodbye.

Unpack the Source Code

Use the tar command to uncompress and untar the compressed tar file:

%tar zxvf bind-9.3.2.tar.gz

Unlike the BIND 8 distribution, this creates a bind-9.3.2 subdirectory in your working directory for all the BIND source code. (BIND 8 distributions always unpacked everything into the working directory.) The bind-9.3.2 subdirectory will have subdirectories called:

bin

Source code for all BIND binaries, including named

contrib

Contributed tools

doc

Documentation for BIND, including the invaluable Administrator Resource Manual

lib

Source code for libraries used by BIND

make

Makefiles

Run configure, and Build Everything

Also unlike BIND 8, BIND 9 uses the near-miraculous configure script to determine the appropriate includes and compiler settings. Read through the README file to determine whether you need any special settings. configure supports command-line options that allow you to build without threads, use a different installation directory, and much more. To run configure:

%./configure

Or, if you need to disable threads, for example, run:

%./configure --disable-threads

To build BIND, type:

%make all

The source code should compile without errors. To install BIND, type this as root:

#make install

That’s all there is!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset