How to install Berkeley DB 4.8 on Linux?
You can compile it using this script in the Bitcoin Core repository:
https://github.com/bitcoin/bitcoin/blob/master/contrib/install_db4.sh . It will give you instructions about how to then ./configure with this compiled version in order to build the project.
Instructions about building Bitcoin Core are available in the /doc folder, for Unix systems it is at
https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md