Skip to content

Instantly share code, notes, and snippets.

@nschmeller
Created July 3, 2021 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nschmeller/b0c046bf39f2d6c2760a55a08ec0149c to your computer and use it in GitHub Desktop.
Save nschmeller/b0c046bf39f2d6c2760a55a08ec0149c to your computer and use it in GitHub Desktop.
Script to install Bitcoin Core v0.21.1 on Ubuntu 20.04
#!/bin/zsh
# sourced from https://hackernoon.com/a-complete-beginners-guide-to-installing-a-bitcoin-full-node-on-linux-2018-edition-cb8e384479ea
# updated for 3 July 2021 versions (specifically 4.8 Berkeley DB that failed to compile)
# there are a few tradeoffs for this approach: Bitcoin Core seems to require Berkeley DB 4.8 for portable wallets (makes sense)
# this script is intended for a node to support the network and not to act as a wallet, so portability isn't an issue
# so, we compile with --with-incompatible-bdb
# we could avoid this problem by installing earlier versions of apt-get packages instead of the latest versions, but
# that would take a lot of time to track down specific versions
# maybe look for versions existing before 3 May 2018? (Date of article publication)
sudo apt-get update
sudo apt-get install git
mkdir -p bitcoin-source && cd bitcoin-source
git clone https://github.com/bitcoin/bitcoin.git
sudo apt-get install build-essential libtool autotools-dev automake pkg-config libssl-dev libevent-dev bsdmainutils python3
sudo apt-get install libboost-all-dev
wget http://download.oracle.com/berkeley-db/db-18.1.40.tar.gz
# TODO find checksum for this download and verify
tar -xvf db-18.1.40.tar.gz
cd db-18.1.40/build_unix
mkdir -p build
BDB_PREFIX=$(pwd)/build
../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX
mkdir ../docs/bdb-sql ../docs/gsg_db_server # cf. https://stackoverflow.com/questions/64707079/berkeley-db-make-install-fails-on-linux
sudo make install
cd ../..
sudo apt-get install libminiupnpc-dev
sudo apt-get install libzmq3-dev
sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
sudo apt-get install libqrencode-dev
cd bitcoin
git checkout tags/v0.21.1
./autogen.sh
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/" --with-gui --with-incompatible-bdb
make
sudo make install
# launch with bitcoin-qt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment