Installation

Time: almost one and a half hour (of which 95% waiting while running the make command)

This part of the guide will take a while, so be prepared. The goal is to compile Bitcoin Core itself. Waht will you be doing?

  • Install dependencies, in order to compile Bitcoin Core you'll need some extra software.
  • Get the source code, throught the use of Git you can get the latest source code.
  • Install database
  • Compile Bitcoin Core

Dependencies

Execute the command below to install all required dependencies. Dependencies are software package other software depends on. Bitcoin Core also depends on other software for its compilation.

sudo apt install git automake autoconf autotools-dev build-essential make pkg-config protobuf-compiler libminiupnpc-dev libprotobuf-dev libdb++-dev libzmq3-dev libsqlite3-dev libboost-thread-dev libboost-test-dev libboost-all-dev libevent-dev libtool libssl-dev libboost-system-dev libboost-filesystem-dev -y

Source code

Make sure you are in you "home directory". To be sure, exucute cd ~. The tilde sign (~) is a short cut for /home/ubuntu in this case. After that, execute the following command to get Bitcoin Core's source code and place it in a folder inside the home directory. A folder named "bitcoi" will automatically be created.

git clone https://github.com/bitcoin/bitcoin

Go inside that folder. This is needed for the installation of Core.

cd bitcoin

Due to the git-flow of Bitcoin Core you could argue that everything inside the master branch is correct and functional. The release process of Bitcoin Core cuts off the master branch at a certain predefined date. Everything on that branch at that momen, will make it into the release. Everything that is added to the branch afterward, will be included in the new release.

If you'd like to specify a certain release (which is recommended), you can execute the command below. At the momen v23 is the latest version of Bitcoin Core.

git checkout v23.0

Database

Inside of the repository of Core is a script to install the database. Bitcoin Core needs this to function. Stay in the current directory (/home/ubuntu/bitcoin) and execute the command below. All of the subsequent command will also be executed from within this directory.

./contrib/install_db4.sh `pwd`
export BDB_PREFIX='/home/ubuntu/bitcoin/db4'

Compiling Bitcoin Core

Finish it off by compiling Bitcoin Core.

./autogen.sh

With the command below we configure the installation process of Bitcoin Core. It is possible to run Bitcoin Core without wallet functionality for examplke, and purely use it as a backend for other wallet software. If you're sure you WON'T be using the wallet functionality, then run:

./configure --without-gui --disable-wallet BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"

The above command has an additional flag --disable-wallet. If you're not sure whether you need the wallet functionality, run the command below.

Did you configure Bitcoin Core without the wallet functionality but still want to add it, execute all commands starting with the one below and work your way down.

Do you want to know about any other option in regards to the installation of Bitcoin Core, run ./configure --help.

./configure --without-gui BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"

A slightly quicker configuration without dependency tracking, tests and benchmarks:

./configure --without-gui --disable-maintainer-mode --disable-dependency-tracking --disable-tests --disable-gui-tests --disable-bench BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include"

After hitting enter for the following command, you can go do something else. From experience we can tell this stel will take around one and a half hour.

make -j $(nproc)

If you'd like to run some test to check whether everything is alright, run make check. This is optional and can take up to fifteen minutes.

Finalize the installation process with the following:

sudo make install

That's it for installing Bitcoin Core! You can go back to your home directory with cd ~.