ISC BIND 9.8 - How to compile it for Linux, Solaris and Windows
ISC BIND 8 (9.8.x) was End-of-Life (EOL) as of Sep 2014 :(
There are a lot of servers use it. The final version is 9.8.8 so I decided to share my experience when compiling it.
The ISC site removed the link to download BIND 9.8 :(
http://www.isc.org/downloads/
Can try to search on their FTP ftp://ftp.isc.org/isc/
Luckily, we can get the ISC BIND DNS 9.8 source from
http://ftp.riken.jp/net/bind/9.8.8/
http://www.mirrorservice.org/sites/ftp.isc.org/isc/bind9/9.8.8/
Linux and Solaris 64 bit
Copy and extract the compressed file bind-9.8.8.tar.gz
cd /opt/mydns/bind98
tar -xvf bind-9.8.8.tar.gz
cd bind-9.8.8
mkdir linux
mkdir linux/bind988
# mkdir solaris
But first, we have to compile 3rd party libraries: OpenSSL, Libxml2, Kerberos
All of them have to be Static and 64 bit
Put them at /opt/buildtools
- http://tuan.nguoianphu.com/OpenSSL_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/LibXML2_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/Kerberos_compile_for_Linux_Solaris_Windows
Create a new configure file config_bind.sh to compile BIND.
Put it in /opt/mydns/bind98/bind-9.8.8
#!/bin/sh ##################################################################### # A configured script to compile ISC BIND in Solaris and Linux in 64 bit # Use 3rd party libraries: OpenSSL, Libxml2, Kerberos # vohungtuan@gmail.com Dec-16-2014 ##################################################################### rm="/bin/rm -f" $rm ./lib/bind/config.log $rm ./lib/bind/config.status $rm ./config.log $rm ./config.status if [ ."$PLATFORM" = . ]; then echo "Set PLATFORM env variable first. exiting" exit fi if [ "$PLATFORM" = "linux" -o $PLATFORM = "linux-gcc3" -o $PLATFORM = "linux-gcc4" ]; then # Use this if development # CFLAGS="-g -m64"; export CFLAGS # production build CFLAGS="-O2 -m64"; export CFLAGS fi if [ "$PLATFORM" = "solaris-2.x" ]; then # needs at least studio12 CC v 5.9 CFLAGS="-xO3 -m64"; export CFLAGS # Development # CFLAGS="-g -m64"; export CFLAGS # CFLAGS="-g"; export CFLAGS fi if [ "$PLATFORM" = "solaris-x86" ]; then # CFLAGS="-g -m64"; export CFLAGS CFLAGS="-xO3 -m64"; export CFLAGS fi STD_CDEFINES="-DUNIX -DEDUP -DGSSRH_MINI -DUPDSEC -DPUSH -DNTFYAL"; export STD_CDEFINES # 64 bit versions of 3rd party libraries: OpenSSL, Libxml2, Kerberos krb_dir=/opt/buildtools/kerberos/kerberos_64bit openssl_dir=/opt/buildtools/openssl/openssl_64bit libxml2_dir=/opt/buildtools/libxml2/linux-gcc3 sh ../configure --prefix=/opt/mydns/bind98/bind-9.8.8/linux/bind988 \ --enable-largefile \ --enable-fixed-rrset \ --enable-filter-aaaa \ --enable-threads \ --with-openssl=$openssl_dir \ --with-gssapi=$krb_dir \ --with-libxml2=$libxml2_dir
Edit these lines to match your machine's configuration
# 64 bit versions of 3rd party libraries: OpenSSL, Libxml2, Kerberos
krb_dir=/opt/buildtools/kerberos/kerberos_64bit
openssl_dir=/opt/buildtools/openssl/openssl_64bit
libxml2_dir=/opt/buildtools/libxml2/linux-gcc3
.....
--prefix=/opt/mydns/bind98/bind-9.8.8/linux/bind988
Compile the BIND source
export PLATFORM=linux-gc33
cd /opt/mydns/bind98/bind-9.8.8
chmod +x config_bind.sh
cd linux
../config_bind.sh
make
make install
cd bind988/sbin
./named -v
./named -V
Windows 32 bit
Build BIND with VS 2010, for VS 2013 please see page of build BIND 9.10.x.
Copy and extract the compressed file bind-9.8.8.tar.gz to C:\bind
We have to compile 3rd party libraries: OpenSSL, Libxml2, Kerberos
Built them as static and 32bit for Windows.
Put them at C:\buildtools
- http://tuan.nguoianphu.com/OpenSSL_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/LibXML2_compile_for_Linux_Solaris_Windows
- http://tuan.nguoianphu.com/Kerberos_compile_for_Linux_Solaris_Windows
However, there are some errors when compile the ISC BIND. The root cause comes from BIND configured file (OMG!).
So we must do these steps for the 3rd party libraries:
Openssl
COPY
C:\buildtools\openssl\openssl-1.0.1j\win32\include
TO
C:\buildtools\openssl\openssl-1.0.1j\win32\inc32
COPY the FILES inside
C:\buildtools\openssl\openssl-1.0.1j\win32\bin
AND the FILES inside
C:\buildtools\openssl\openssl-1.0.1j\win32\lib
TO
C:\buildtools\openssl\openssl-1.0.1j\win32\out32dll
Kerberos
COPY the FILES inside
C:\buildtools\kerberos\krb5-1.13\win32\lib
TO
C:\buildtools\kerberos\krb5-1.13\win32\lib\i386
Libxml2
COPY the FILES inside
C:\buildtools\libxml2\libxml2-2.9.2\win32\lib
AND the FILES inside
C:\buildtools\libxml2\libxml2-2.9.2\win32\bin
TO
C:\buildtools\libxml2\libxml2-2.9.2\win32\win32\bin.msvc
Run configuration for source code
Go to C:\bindbind-9.8.8\win32utils
There is a error in the Configure file, we have to hack it :(
Open the Configure and replace this line:
if (!grep { -f and -x } $vcredist_path) {
TO
if (grep { -f and -x } $vcredist_path) {
BIND 9.8.8: Line 1915
BIND 9.9.6-P1: Line 1923
Skip these steps if you done when compiling Kerberos.
We have to install Perl (Active Perl) and Python (Active Python).
And the gawk tool.
Extract it to C:\gawk
Install Cygwin to get or find these files:
grep.exe
mv.exe
rm.exe
cat.exe
sed.exe
Copy them to C:\gawk\bin
Open cmd and
cd C:\bindbind-9.8.8\win32utils
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
SET PATH=%PATH%;C:\gawk\bin
perl Configure win32 with-openssl=C:\buildtools\openssl\openssl-1.0.1j\win32 with-libxml2=C:\buildtools\libxml2\libxml2-2.9.2\win32 with-gssapi=C:\buildtools\kerberos\krb5-1.13\win32 with-vcredist="C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
For BIND 9.8.8, we also have to remove this line (line 28) in bind9.sln (OMG! again)
{FD653434-F1A8-44A9-85B2-A7468491DA6D} = {FD653434-F1A8-44A9-85B2-A7468491DA6D}
OK, let's compile it!
msbuild /t:Build /p:Configuration=Release