Follow the below steps to install BerkeleyDB.
Downloading Berkeley DB
wget http://download.oracle.com/berkeley-db/db-5.2.28.tar.gz
Extracting files from the downloaded package:
tar zxvf db-5.2.28.tar.gz cd db-5.2.28/build_unix
Create installation path
mkdir /etc/berkeleydb
Configuring Berkeley DB
../dist/configure --prefix=/etc/berkeleydb
Compile and install the code
make make install