Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Compile Bitcoin on Ubuntu 14.04
Assuming the username of the Ubuntu user is "theusername".
Preparation
-----------
```
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libqt5gui5 libqt5core5 libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler
sudo apt-get install libqrencode-dev
sudo apt-get install libminiupnpc-dev
```
Download bitcoin source code
----------------------------
```
cd ~
git clone https://github.com/bitcoin/bitcoin.git
```
Download and compile Berkley DB 4.8
-----------------------------------
```
cd ~
mkdir bitcoin/db4/
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/
make install
```
Compile Bitcoin with Berkley DB 4.8
-----------------------------------
```
cd ~/bitcoin/
./autogen.sh
./configure LDFLAGS="-L/home/theusername/bitcoin/db4/lib/" CPPFLAGS="-I/home/theusername/bitcoin/db4/include/"
make -s -j5
```
Run Bitcoin Daemon/QT/Client
----------------------------
```
./src/bitcoind
./src/bitcoin-qt
./src/bitcoin-cli
```
Please share your experience and provide constructive feedback!
Thanks,
--- Kosta
Owner

kostaz commented Aug 20, 2014

Updated: added "protobuf-compiler" as dependency.

I was able to compile with Qt on Ubuntu 12.04 LTS:
https://gist.github.com/nivertech/778347fa47aee459ed9c

How to disable downloading of blockchain?
Is this possible to download dump of the blockchain and put it on external USB drive?

asubbarao commented Feb 19, 2017

I am fine up to line 49 "./src/bitcoind" but then I get the error message as following:


alok@as-Thinkpad:~/bitcoin$ ./src/bitcoind
: Incorrect or no genesis block found. Wrong datadir for network?

Any help please?

djp3 commented Mar 13, 2017

I needed to install libevent-dev and libqt5core5a
Thanks for this guide!

anhgien commented Apr 16, 2017

@asubbarao: you just remove ~/.bitcoin directory with cmd "rm -rf ~./bitcoin"

rusticbison commented Apr 19, 2017

I needed to install libevent-dev and libqt5core5a

I am running Ubuntu 16.04.2 LTS and also needed to install libqt5core5a.

Additionally, I had compiler issues when I attempted:
make -s -j5

This solution worked for me:
https://bitcointalk.org/index.php?topic=304389.0

free
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img
free
make -f Makefile 

Here is what I did for ubuntu 16:

sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install -y libdb4.8-dev libdb4.8++-dev

Worked great, for ubuntu 16, had to add libevent-dev, and libqt5core5a instead of libqt5core5.

thanks

Nurdur commented Sep 21, 2017

After entering line 33: (../dist/configure --enable-cxx --disable-shared --with-pic --prefix=/home/theusername/bitcoin/db4/) I get:

configure: error: libdb_cxx headers missing, Bitcoin Core requires this library for wallet functionality

Edit: Ubuntu 16.04.3 LTS

JReganE commented Nov 16, 2017

Thanks for this.

I'm stuck at line 42, Compile Bitcoin with Berkley DB 4.8, I get: -bash: ./configure: No such file or directory

Any help???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment