Skip to content

Instantly share code, notes, and snippets.

Last active October 3, 2023 08:57
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Koff/1638aca30d6e14f1dcd374825018074a to your computer and use it in GitHub Desktop.
Bitcoin core 0.20.0 on Ubuntu 19.10
# Assuming a fresh install of Ubuntu 19.10, 400+Gbytes of free HDD, and that you are logged in as root.
# More detailed instructions available in
# Update packages
apt update
apt upgrade -y
# Add bitcoin_user user non-interactively
adduser --gecos "" bitcoin_user
# Add bitcoin_user to sudoers, so that it can run sudo commands
usermod -aG sudo bitcoin_user
# Log in as bitcoin user
su - bitcoin_user
# Install all dependencies to build bitcoin core
sudo apt install -y git build-essential autoconf libtool pkg-config libdb++-dev libboost-all-dev libssl-dev libevent-dev
# If you want wallet support, build BerkeleyDB, otherwise skip until the section to clone bitcoin
tar -xvf db-4.8.30.NC.tar.gz
# fix the bug on BerkeleyDB
sed -i 's/__atomic_compare_exchange/__atomic_compare_exchange_db/g' db-4.8.30.NC/dbinc/atomic.h
# Configure
cd db-4.8.30.NC/build_unix
mkdir -p build
BDB_PREFIX=$(pwd)/build # we will use this shell variable later
../dist/configure --disable-shared --enable-cxx --with-pic --prefix=$BDB_PREFIX
# Compile and install BerkelyDB
sudo make install
# Go back to home directory
# Clone bitcoin repo and checkout latest tag, today that is v.0.20.0
git clone
cd bitcoin
git checkout v0.20.0
# Build bitcoin
# If you installed BerkeleyDB,
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"
# else
./configure --disable-wallet
# in either case
sudo make install
# Start bitcoin daemon
bitcoind -daemon
# After ~1 minute, check status
bitcoin-cli getblockchaininfo
# Optionally, add this line to crontab -e to start bitcoind after reboot/shutdown.
@reboot /usr/local/bin/bitcoind --daemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment