Skip to content

Instantly share code, notes, and snippets.

@Koff
Last active April 7, 2024 16:11
Show Gist options
  • Save Koff/1638aca30d6e14f1dcd374825018074a to your computer and use it in GitHub Desktop.
Save Koff/1638aca30d6e14f1dcd374825018074a to your computer and use it in GitHub Desktop.
Bitcoin core 26.1 on Ubuntu 23.10
# Assuming a fresh install of Ubuntu 23.10, 400+Gbytes of free HDD, and that you are logged in as root.
# More detailed instructions available in https://www.fsanmartin.co/running-a-bitcoin-node-on-ubuntu-19-10/
# 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
wget http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz
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
make
sudo make install
# Go back to home directory
cd
# Clone bitcoin repo and checkout latest tag, today that is v.0.20.0
git clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v26.1
# Build bitcoin
./autogen.sh
# If you installed BerkeleyDB,
./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2" LDFLAGS="-L${BDB_PREFIX}/lib/"
# else
./configure --disable-wallet
# in either case
make
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