# If you want to remove Berkeley DB or read more info about what is
# installed, skip down to the bottom for the "Some other
# configuration" section
# The 4.8.x release covered here was announced on May 1, 2010
#
# 4.8.x is the version included with Slackware 15.0, while the latest
# version of Berkeley DB available from Oracle is 18.1.40
#
# After a licensing change and some other alternative options becoming
# available and more usable, and distributions deciding to deprecate
# Berkeley DB, it's use has dropped of significantly.
# See the Wikipedia page and/or you can find many articles online for more
# info about that.
#
# I leave this here in case you need to install or rebuild a libdb for
# use with any of these until support for it is removed/replaced:
# Apache HTTP
# Cyrus SASL
# Cyrus IMAP
# sendmail
# If you install Berkeley DB with the 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 consider running
# 'removepkg db4 db42 db44 db48 ...' before you run 'make install' to make
# sure there aren't any old files left over. ...keeping in mind that
# the files you would be removing may be in use.
# Berkeley DB 4.4.20
# ==================
# Get the tarball
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
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "db-4.4.*" -exec rm -r {} \;
tar xzvf ~/db-4.4.20.tar.gz
cd db-4.4.20
test $UID = 0 && chown -R root:root .
chmod -R u+w .
## Alternate download location if not available from Oracle
## http://ftp.slackware.com/pub/slackware/slackware64-14.2/source/l/db44/
# Apply 4 bugfix patches:
for pnum in `seq 4`; do
wget -nc http://www.sleepycat.com/update/4.4.20/patch.4.4.20.$pnum &&
patch -p0 < patch.4.4.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 $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/db-4.4.*.tar.*
mv db-4.4.20.tar.gz installed/
# Skip down to the bottom for some other configuration
# Berkeley DB 4.5.20
# ==================
# Get the tarball
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 DB 4.7.25
# ==================
# Get the tarball
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
# Extract the source
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 $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/db-4.7.*.tar.*
mv db-4.7.25.tar.gz installed/
# Skip down to the bottom for some other configuration
# Berkeley DB 4.8.30
# ==================
# Get the tarball
cd
test -f installed/db-4.8.30.tar.gz && mv installed/db-4.8.30.tar.gz .
test ! -f db-4.8.30.tar.gz &&
wget https://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
# Verify tarball w/ sha256sum:
# (this one is from me, not from Oracle, only proves yours is the same)
echo "e0491a07cdb21fb9aa82773bbbedaeb7639cbd0e7f96147ab46141e0045db7\
2a db-4.8.30.tar.gz" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "db-4.8.*" -exec rm -r {} \;
tar xzvf ~/db-4.8.30.tar.gz
cd db-4.8.30
test $UID = 0 && chown -R root:root .
## Do what Slackware does with this patch
#http://ftp.slackware.com/pub/slackware/slackware64-15.0/\
#source/l/db48/db.rename.atomic_compare_exchange.diff.gz
sed -i.orig \
-e 's/__atomic_compare_exchange/__db_atomic_compare_exchange/' \
dbinc/atomic.h
## Slackware just skips the docs, here I "fix" configure --docdir
## 68MiB/71MB is definitely excessive, I remember having entire hard drives
## smaller than that, but not a big concern these days...
#wget http://ftp.slackware.com/pub/slackware/slackware64-15.0/\
#source/l/db48/db48.no.broken.doc.install.diff.gz
sed -i.orig -e 's%$(prefix)/docs$%@docdir@%' dist/Makefile.in
# Move to the build directory
cd build_unix
# If you previously ran configure, clean it up
test -f config.log && make distclean
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
../dist/configure \
--prefix=/usr --docdir=/usr/doc/db-4.8.30 --libdir=/usr/lib64 \
--enable-compat185 --enable-cxx
# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
../dist/configure \
--prefix=/usr --docdir=/usr/doc/db-4.8.30 \
--enable-compat185 --enable-cxx
# Build it
make
# Become root to install it
su
# Remove the Slackware package, if there is one
# If you will only ever be using 4.8.x, may want to remove db42 and db44
# also if you run Slackware < 15.0 they may all be installed
# (because of aaa_elflibs there will still be /lib/libdb-4.*)
test -x /sbin/removepkg && /sbin/removepkg db48
# Install it
make install
# If you're going to have multiple versions of DB 4, you may want
# to do this:
# mkdir -p /usr/include/db48
# ( cd /usr/include
# mv -f db.h db_cxx.h db_185.h db48/
# ln -s db48/db.h
# ln -s db48/db_cxx.h
# ln -s db48/db_185.h )
# If 64-bit...
# Move libdb-4.8.so in to /lib64 in case /usr is mounted after /
# And create symlinks that may be expected by other software
test $(uname -m) = 'x86_64' -a -d /usr/lib64 &&
( cd /usr/lib64
test ! -L /lib64/libdb-4.8.so && ln -sf /lib64/libdb-4.8.so
ln -sf libdb-4.8.a libdb-4.a
ln -sf libdb-4.8.a libdb4.a
ln -sf libdb-4.8.a libdb.a
ln -sf libdb_cxx-4.8.a libdb_cxx-4.a
ln -sf libdb_cxx-4.8.a libdb_cxx.a
ln -sf libdb-4.8.so libdb4.so
ln -sf libdb-4.8.so libdb.so )
# If NOT 64-bit...
# Move libdb-4.8.so in to /lib in case /usr is mounted after /
# And create symlinks that may be expected by other software
test $(uname -m) != 'x86_64' &&
( cd /usr/lib
test ! -L /lib/libdb-4.8.so && ln -sf /lib/libdb-4.8.so
ln -sf libdb-4.8.a libdb-4.a
ln -sf libdb-4.8.a libdb4.a
ln -sf libdb-4.8.a libdb.a
ln -sf libdb_cxx-4.8.a libdb_cxx-4.a
ln -sf libdb_cxx-4.8.a libdb_cxx.a
ln -sf libdb-4.8.so libdb4.so
ln -sf libdb-4.8.so libdb.so )
# They're leaving everything owned by the user:group that compiled it
# Correct that to root:root
chown root:root /usr/bin/db_* /lib*/libdb-4.8.so
chown -R root:root /usr/doc/db-4.8.30
( cd /usr/include
chown root:root db.h db_cxx.h db_185.h 2> /dev/null )
test -d /usr/include/db48 &&
( cd /usr/include/db48
chown root:root db.h db_cxx.h db_185.h 2> /dev/null )
( cd /usr/lib
chown root:root libdb-4.8.a libdb-4.8.la 2> /dev/null)
test -d /usr/lib64 &&
( cd /usr/lib64
chown root:root libdb-4.8.a libdb-4.8.la
chown root:root libdb_cxx-4.8.a libdb_cxx-4.8.la libdb_cxx-4.8.so )
# Update /etc/ld.so.cache
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the tarball for later
cd
mkdir -p -m 0700 installed
rm -f installed/db-4.8.*.tar.*
mv db-4.8.30.tar.gz installed/
# 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 /lib*/libdb.so or /usr/lib*/libdb.so 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.?/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 and install it using --prefix=/usr.
# Just keep in mind that if an appliaction is linked to libdb-x.x.so and
# you remove that, that application will break.
# To remove old versions of db4, first run 'make uninstall' as root from
# the source build_unix directory, and then 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 db48
mkdir -p -m 0700 ~/backup/bdb/db4
test -d /usr/include/db4 && mv -f /usr/include/db4 ~/backup/bdb/db4/
find /lib -name "libdb-4.*.so" -exec mv -f {} ~/backup/bdb/db4/ \;
find /lib64 -name "libdb-4.*.so" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/lib -name "libdb-4.*.so" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/lib64 -name "libdb-4.*.so" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/lib -name "libdb4.*" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/lib64 -name "libdb4.*" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/bin -type f -name "db4_*" -exec mv -f {} ~/backup/bdb/db4/ \;
find /usr/bin -type f -name "db_*" -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 last one 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