Linux HOWTOs

About | Home | Search


HOWTO: db3
Description: Database library and utilities
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# Berkeley db3 3.3.11
# ===================
# Different versions of Slackware include db1, db2, db3, and db4 packages.
# Just listing 3.x versions - Slackware 9.0 and 9.1 include 3.3.11, 10.0,
# 10.1, and 10.2 include both 3.1.17 and 3.3.11  Slackware 11.0 includes
# 4.x versions.

# See the db4 howto for the current version

cd
test -f installed/db-3.3.11.tar.gz && mv installed/db-3.3.11.tar.gz .
test ! -f db-3.3.11.tar.gz &&
 wget http://www.sleepycat.com/update/snapshot/db-3.3.11.tar.gz
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "db-*" -exec rm -r {} \;
tar xzvf ~/db-3.3.11.tar.gz
cd db-3.3.11
test $UID = 0 && chown -R root:root .

# Apply two patches to fix some bugs:
wget -nc http://www.sleepycat.com/update/3.3.11/patch.3.3.11.1 \
 http://www.sleepycat.com/update/3.3.11/patch.3.3.11.2
test -f patch.3.3.11.1 && patch -p0 < patch.3.3.11.1
test -f patch.3.3.11.2 && patch -p0 < patch.3.3.11.2

cd build_unix

# If you want an exact replacement for the Slackware installed db3, add
# --prefix=/usr to the configure line, otherwise it'll be installed to
# /usr/local/BerkeleyDB.3.3 (which might be better to avoid conflicts).  If
# you do use --prefix=/usr, you should run "removepkg db3" before you run
# "make install" below.

../dist/configure \
 --enable-compat185 \
 --enable-rpc \
 --enable-shared
make
su -c "make install"
cd
mkdir -p -m 0700 installed
mv db-3.3.11.tar.gz installed/


# If you installed it with the default prefix (/usr/local/BerkeleyDB.3.3) and
# are installing it for everything to use from now on (instead of a
# libdb1/2/3/4 in /usr) you'll probably need to do something like this below.
# Be careful though of anything you have that uses a different version of the
# libdb shared libraries and make sure it still works.  ie. if you're upgrading
# from db2 to db3 and libdb2.so no longer exists, any apps linked to it will be
# broken.  If you're replacing a Slackware-installed db3 and want to remove
# the old version, run "removepkg db3".

# Become root
su

# Clear out and back up potentially conflicting files:
mkdir -p ~/backup/db3
test -d /usr/include/db3 && mv -f /usr/include/db3 ~/backup/db3/
test -f /usr/lib/libdb.a && mv -f /usr/lib/libdb.a ~/backup/db3/
find /lib -type f -name "libdb-3*.so" -exec mv -f {} ~/backup/db3/ \;
find /usr/bin -type f -name "db_*" -exec mv -f {} ~/backup/db3/ \;
test -L /usr/include/db.h && rm /usr/include/db.h
test ! -L /usr/include/db.h && mv /usr/include/db.h ~/backup/db3/

# Get the new db3 noticed:
ln -sf /usr/local/BerkeleyDB.3.3/include/db.h /usr/include/db.h
ln -sf /usr/local/BerkeleyDB.3.3/lib/libdb.a /usr/lib/libdb.a
echo '#!/bin/sh' > /etc/profile.d/db3.sh
echo 'export PATH=$PATH:/usr/local/BerkeleyDB.3.3/bin' >> /etc/profile.d/db3.sh
chmod 755 /etc/profile.d/db3.sh
echo $PATH | grep "/usr/local/BerkeleyDB.3.3/bin" > /dev/null 2>&1 ||
 export PATH=$PATH:/usr/local/BerkeleyDB.3.3/bin
grep "^/usr/local/BerkeleyDB.3.3/lib$" /etc/ld.so.conf > /dev/null 2>&1 ||
 echo "/usr/local/BerkeleyDB.3.3/lib" >> /etc/ld.so.conf &&
 ldconfig

# Become yourself again
exit

# Even after doing everything above, you still may need to pass configure
# options to certain apps when building to get it to find the includes.
# Unless there's a configure option like --with-db3-includes, use something
# like this to pass the include directory to configure:
# CPPFLAGS="-I/usr/local/BerkeleyDB.3.3/include" ./configure

Back to the list


Last updated: Wed, 29 Apr 2020 22:04:50 -0400
Jason Englander <jason at englanders dot us>