Berkeley DB-4.5.20

Introduction to Berkeley DB

The Berkeley DB package contains programs and utilities used by many other applications for database related functions. This package is also installed during LFS and may already exist on your system. It is listed here in BLFS as well because you may need to reinstall it if you need the additional language bindings or the RPC server. If you do reinstall Berkeley DB, ensure you use the 4.5.20 version used in the LFS book.

Package Information

Additional Downloads

Berkeley DB Dependencies


Tcl-8.4.18, JDK-6 Update 5, and sharutils (for the uudecode command)

User Notes:

Testing Berkeley DB

You may want to skip ahead to the section called “Installation of Berkeley DB”. The test suite can take up to 150 SBUs and has a few bugs causing a report of “Regression tests failed”. However, running the test suite is a very exhaustive test of your hardware, perhaps pushing your machine harder (especially disk I/O) than it will ever see during production use. Note that you must have Tcl installed to run the test suite.

Build for the Berkeley DB test by running the following commands:

patch -Np0 -i ../patch. &&
patch -Np0 -i ../patch. &&
cd build_unix &&
../dist/configure --prefix=/usr \
                  --enable-test \
                  --enable-tcl  \
                  --with-tcl=/usr/lib &&

To test the results, start tclsh:


From the tclsh prompt (), run:

source ../test/test.tcl
run_parallel 5 run_std

Clean up the source tree with the following command:

make realclean &&
cd ..

Installation of Berkeley DB

The installation commands below are identical to the commands used in the LFS book. If you installed Berkeley DB in LFS, and you don't add anything to the configure script, you'll end up with exactly what you already have. The additional parameters you can use are listed in the Command Explanations section below.



If you plan on installing Berkeley DB with Java support, you should check the system for certain versions of JDK-6 Update 5 and GMime-2.2.10. Specifically, if JDK-6 Update X and the uudecode program from the GMime program is on the system, the build will fail (unless you run the modified ./configure command shown below). You can run two commands (javac -version and uudecode --version) to determine what versions are installed. You can also download and run a shell script from that will alert you to a non-working condition. If the identified programs exist on the system, you must modify the ./configure command as shown below.

uudecode="no" ../dist/configure --(use the parameters shown below)

Install Berkeley DB by running the following commands:

patch -Np0 -i ../patch. &&
patch -Np0 -i ../patch. &&
cd build_unix &&
../dist/configure --prefix=/usr \
                  --enable-compat185 \
                  --enable-cxx &&

Now, as the root user:

make docdir=/usr/share/doc/db-4.5.20 install &&
chown -v -R root:root \
      /usr/bin/berkeley_db_svc \
      /usr/bin/db_* \
      /usr/include/db{,_185,_cxx}.h \
      /usr/lib/libdb{{,_cxx}.a,{,_cxx,_java,_tcl}-4.5.{so,a,la}} \

Command Explanations

cd build_unix && ../dist/configure --prefix=/usr...: This replaces the normal ./configure command, as Berkeley DB comes with various build directories for different platforms.

--enable-compat185: This switch enables building the DB-1.85 compatibility API.

--enable-cxx: This switch enables building C++ API libraries.

--enable-tcl --with-tcl=/usr/lib: Enables Tcl support in DB and creates the libdb_tcl libraries.

--enable-java: Enables Java support in DB and creates the libdb_java libraries.

--enable-rpc: Enables building the Berkeley DB RPC server.

make docdir=/usr/share/doc/db-4.5.20 install: This installs the documentation in the standard location instead of /usr/docs.

chown -v -R root:root ...:This command changes the ownership of various installed files from the uid:gid of the builder to root:root.


Only the program and libraries not installed in LFS are listed here, the others can be found at ../../../../lfs/view/6.3/chapter06/db.html#contents-db as they were initially installed during the building of LFS.

Installed Program: berkeley_db_svc
Installed Libraries: libdb_java.{so,a}, libdb_tcl.{so,a} and db.jar
Installed Directory: /usr/share/doc/db-4.5.20

Short Descriptions


is the Berkeley DB RPC server.

Last updated on 2008-03-24 23:00:38 -0500