Compile Bitcoin Core from Source on Ubuntu 16.04

Compile Bitcoin Core from Source on Ubuntu 16.04

Why Compile?

The main reason to compile Bitcoin Core yourself is that it ensures you’ll always have access to the latest release. For example, the binary Bitcoin Core package for Ubuntu 14.04 32-bit currently fails to install, giving the error message “E: Unable to locate package bitcoin-qt” (the 64-bit version installs without a problem). Compiling and installing from source eliminates the need to rely on precompiled binaries when updating.

A secondary reason to compile from source is that it requires less trust. Although the maintainers of the Bitcoin Core binary package do a fine job, binaries are a few steps removed from raw source code. With each step comes to potential for unexpected issues that can’t be easily detected. Source code, in contrast, can be inspected before compilation and installation.

Yet another reason to compile from source is to enable custom behavior. For example, the Bitcoin Core GUI and wallet can be disabled if you plan to use the software without those features.


The method for installing Bitcoin Core described here requires that you enter text-based commands. The preferred way to do this is through the Terminal application. To access it, click the swirl button in the upper left of the desktop and type “terminal”. Click the leftmost button labeled “Terminal” to launch the application.


$ sudo apt-get install git

Next, create a source directory and clone the Bitcoin Core source repository.

$ mkdir -p src && cd src
$ git clone

After a short time, all files should be ready. To confirm, use the lscommand.

ls bitcoin

Install Dependencies

$ sudo apt-get install build-essential

Downloading and verifying the BerkeleyDB source package.

$ wget
$ echo '2edc0df75bf9abd7f82f821795bcee50f42cb2e5f76a6a281b85732798364ef db-4.8.30.NC.tar.gz' | sha256sum -c

Next, unpack the BerkeleyDB source and compile.

$ tar -xvf db-4.8.30.NC.tar.gz
$ cd db-4.8.30.NC/build_unix
$ mkdir -p build
$ BDB_PREFIX=$(pwd)/build
$ ../dist/configure —disable-shared —enable-cxx —with-pic —prefix=$BDB_PREFIX
$ make install
$ cd ../..

The remaining dependencies can be installed with a single command.

$ sudo apt-get install autoconf libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libtool pkg-config libevent-dev

Compile Bitcoin Core

$ cd bitcoin
$ ./
$ ./configure CPPFLAGS="-I${BDB_PREFIX}/include/ -O2“ LDFLAGS=”-L${BDB_PREFIX}/lib/" —with-gui
$ make
$ sudo make install

Run Bitcoin Core

$ bitcoin-qt

Leave a Reply

Your email address will not be published. Required fields are marked *