# I have several versions of bdb 4 in this howto. You should use the
# latest stable release unless you have applications that were created
# before it was released, (sometimes) requiring an older version. You
# can install all of them (as done below) without trouble, but I'd stick
# with only what's necessary.
# If you install these with their default prefix of
# /usr/local/BerkeleyDB.4.x, you don't have to worry about it conflicting
# with an existing db4 installation. If you'd rather replace the Slackware
# installed db4 (or just install it the same way), add --prefix=/usr to the
# configure line below. If you do that, you should run 'removepkg db4 db42
# db44' before you run 'make install' to make sure there aren't any old
# files left over.
# Berkeley db4 4.4.20
# ===================
cd
test -f installed/db-4.4.20.tar.gz && mv installed/db-4.4.20.tar.gz .
test ! -f db-4.4.20.tar.gz &&
wget http://download.oracle.com/berkeley-db/db-4.4.20.tar.gz
# Skip down to the bottom for some other configuration
# Berkeley db4 4.5.20
# ===================
cd
test -f installed/db-4.5.20.tar.gz && mv installed/db-4.5.20.tar.gz .
test ! -f db-4.5.20.tar.gz &&
wget http://download.oracle.com/berkeley-db/db-4.5.20.tar.gz
# Verify tarball w/ md5sum:
# (I couldn't find one elsewhere, so this one is from me, not from Oracle)
echo "b0f1c777708cb8e9d37fb47e7ed3312d db-4.5.20.tar.gz" | md5sum -c
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "db-4.5.*" -exec rm -r {} \;
tar xzvf ~/db-4.5.20.tar.gz
cd db-4.5.20
test $UID = 0 && chown -R root:root .
chmod -R u+w .
# Apply 2 bugfix patches:
for pnum in `seq 2`; do
wget -nc http://www.oracle.com/technology/products/berkeley-db/db/update/\
4.5.20/patch.4.5.20.$pnum &&
patch -p0 < patch.4.5.20.$pnum
echo "Hit enter to continue"
read
done
cd build_unix
../dist/configure \
--enable-compat185 \
--enable-rpc \
--enable-shared
make
# Become root to install it
su
# Install it
make install
# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .
# Skip down to the bottom for some other configuration
# Berkeley db4 4.7.25
# ===================
cd
test -f installed/db-4.7.25.tar.gz && mv installed/db-4.7.25.tar.gz .
test ! -f db-4.7.25.tar.gz &&
wget http://download.oracle.com/berkeley-db/db-4.7.25.tar.gz
# Verify tarball w/ md5sum:
# (I couldn't find one elsewhere, so this one is from me, not from Oracle)
echo "ec2b87e833779681a0c3a814aa71359e db-4.7.25.tar.gz" | md5sum -c
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "db-4.7.*" -exec rm -r {} \;
tar xzvf ~/db-4.7.25.tar.gz
cd db-4.7.25
test $UID = 0 && chown -R root:root .
# Apply 3 bugfix patches:
for pnum in `seq 3`; do
wget -nc http://www.oracle.com/technology/products/berkeley-db/db/update/\
4.7.25/patch.4.7.25.$pnum &&
patch -p0 < patch.4.7.25.$pnum
echo "Hit enter to continue"
read
done
cd build_unix
../dist/configure \
--enable-compat185 \
--enable-rpc \
--enable-shared
make
# Become root to install it
su
# Install it
make install
# Make sure your non-root user can remove the source later
chown -R $USER .
chmod -R u+w .
# Skip down to the bottom for some other configuration
# "Some other configuration"
# ==========================
# Become root
su
# Be ready for things to potentially go crazy when you start doing this.
#
# You can run 'lsof /usr/lib/libdb.so' to get an idea of what running
# apps are using the current version that is installed in the
# system-wide location of /usr/lib/libdb.so (if there is one) or
# /usr/local/lib/libdb.so and other directories that you may have
# set in /etc/ld.so.conf
#
# If things are linked with the full path of the older-version Berkeley
# DB library, like /usr/local/BerkeleyDB.4.2/lib/libdb.so, then you
# should be OK. Go through the procedure below, then rebuilding that
# app and it should start using the new version you installed.
#
# ...but if things are linked to /usr/lib/libdb.so and you change that,
# then you may have trouble.
#
# If you use something like Cyrus IMAP, you'll probably want to shut it
# down, install the new BDB, rebuild and reinstall Cyrus, run the
# 'db_upgrade' utility in /var/imap, then start Cyrus again.
# You may have to do some things with OpenLDAP's daemons (slapd/slurpd),
# sendmail, etc... Sendmail will probably be fine with 'newaliases',
# running 'make' in /etc/mail, or whatever you usually do to create
# the .db files in there - if you have it using Berkeley DB.
# If you installed it with the default prefix, it's installed as
# /usr/local/BerkeleyDB.X.X If you build something that uses bdb, it
# probably won't find it there. Some things will have a configure flag
# like --with-db-includes and --with-db-libs so you can tell it where to
# find them. If something like that is not available, pass it
# CPPFLAGS="-I/usr/local/BerkeleyDB.X.X/include"
# to find the includes and
# LDFLAGS="-L/usr/local/BerkeleyDB.X.X/lib"
# to find the libraries.
# You can also make your newly installed BDB available system-wide without
# having to specify it's location. To do this, you'll have to either zap or
# at least, move conflicting files. Just keep in mind that if an appliaction
# is linked to libdb-3.3.so and you remove it, that application will break.
# To remove old versions of db4, run this. You may be able to skip this and
# just run the 'Get the new version(s) noticed' part below, but certain apps
# like Cyrus IMAP and SASL still have (had?) trouble without doing this.
test -x /sbin/removepkg && /sbin/removepkg db4 db42 db44
mkdir -p -m 0700 ~/backup/bdb/db4
test -d /usr/include/db4 && mv -f /usr/include/db4 ~/backup/bdb/db4/
find /lib /usr/lib -name "libdb-4.*.so" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/lib -name "libdb4.*" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/bin -type f -name "db4_*" -exec mv -f {} ~/backup/bdb/db4/ \;
test -f /usr/bin/berkeley_db4_svc &&
mv -f /usr/bin/berkeley_db4_svc ~/backup/bdb/db4/
# To remove files that could be from either of them:
test ! -d ~/backup/bdb && mkdir -p -m 0700 ~/backup/bdb
find /usr/bin -type f -name "db_*" -exec mv -f {} ~/backup/bdb/ \;
for file in /usr/lib/libdb.a /usr/lib/libdb.so /usr/include/db.h
do
test -L $file && rm $file
test -f $file && mv $file ~/backup/bdb/
done
# Get the new version(s) noticed. Not that you should, but if you did
# install all of them, the "default" one would be the highest version that
# you installed.
#
# This will create a /usr/include/db.h symlink, a /usr/lib/libdb.a symlink,
# a /usr/lib/libdb.so symlink, a /etc/profile.d/db4.sh to add the bin
# directory to your PATH when you login, and will update /etc/ld.so.conf
# Update your current shell's PATH with db's bin directory:
test -x /etc/profile.d/db4.sh &&
echo $PATH | grep -q /usr/local/BerkeleyDB ||
. /etc/profile.d/db4.sh