This chapter includes databases that range from single-user read/write to industrial database servers with transaction support. Generally, you will be sent here to satisfy dependencies to other applications although building a SQL server on a base LFS system is entirely possible.

Berkeley DB-4.4.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.4.20 version used in the LFS book.

Package Information

Additional Downloads

Berkeley DB Dependencies


Tcl-8.4.13, JDK-1.5.0_10, 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:

for PATCH in ../patch.4.4.20.{1..4}; do patch -Np0 -i $PATCH; done &&
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. Install Berkeley DB by running the following commands:

for PATCH in ../patch.4.4.20.{1..4}; do patch -Np0 -i $PATCH; done &&
cd build_unix &&
../dist/configure --prefix=/usr \
                  --enable-compat185 \
                  --enable-cxx &&

Now, as the root user:

make docdir=/usr/share/doc/db-4.4.20 install &&
chown -v root:root /usr/bin/db_* /usr/lib/libdb* /usr/include/db* &&
chown -v root:root /usr/bin/berkeley_db_svc &&
chown -v -R root:root /usr/share/doc/db-4.4.20

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.4.20 install: This installs the documentation in the correct location instead of /usr/docs.

chown -v root:root /usr/bin/berkeley_db_svc: This command changes the ownership of the RPC server program. It is only required if you passed --enable-rpc to the configure script.


Only the program and libraries not installed in LFS are listed here, the others can be found at ../../../../lfs/view/6.2/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} and libdb_tcl.{so,a}
Installed Directory: /usr/share/doc/db-4.4.20

Short Descriptions


is the Berkeley DB RPC server.

Last updated on 2007-01-15 18:08:14 -0600