Skip to content

Instantly share code, notes, and snippets.

Embed
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
@kostaz

This comment has been minimized.

Copy link
Owner Author

kostaz commented Aug 20, 2014

Updated: added "protobuf-compiler" as dependency.

@nivertech

This comment has been minimized.

Copy link

nivertech commented Aug 25, 2014

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

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

djp3 commented Mar 13, 2017

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

@anhgien

This comment has been minimized.

Copy link

anhgien commented Apr 16, 2017

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

@rusticbison

This comment has been minimized.

Copy link

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 
@juanpastas

This comment has been minimized.

Copy link

juanpastas commented Apr 24, 2017

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
@earonesty

This comment has been minimized.

Copy link

earonesty commented Jul 24, 2017

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

@TTcoinDeveloper

This comment has been minimized.

Copy link

TTcoinDeveloper commented Sep 18, 2017

thanks

@Nurdur

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

JReganE commented Nov 16, 2017

Thanks for this.

@bitcoineconomics2018

This comment has been minimized.

Copy link

bitcoineconomics2018 commented Dec 1, 2017

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

Any help???

@caikehe

This comment has been minimized.

Copy link

caikehe commented Jan 24, 2018

solution works for me on Ubuntu 16.04:

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

@wuqichun

This comment has been minimized.

Copy link

wuqichun commented Jan 28, 2018

i've been trying

@bensonkb

This comment has been minimized.

Copy link

bensonkb commented Feb 10, 2018

However the following packages replace it:
libqt5core5a

E: Package 'libqt5core5' has no installation candidate

Update this to document

@xiaonan778

This comment has been minimized.

Copy link

xiaonan778 commented Feb 11, 2018

@caikehe It works! thx

@sken77

This comment has been minimized.

Copy link

sken77 commented Feb 12, 2018

in Ubuntu 16 you also need to run

sudo apt-get install libevent-dev

@smartmanjp

This comment has been minimized.

Copy link

smartmanjp commented Mar 6, 2018

Hello I was installing this to learn and i get stack on make -s -j5 I get this terry@rootminingpool:/bitcoin$ make -s -j5
make: *** No targets specified and no makefile found. Stop.
terry@rootminingpool:
/bitcoin$
Any help

@smartmanjp

This comment has been minimized.

Copy link

smartmanjp commented Mar 6, 2018

and inside the fold i have
terry@rootminingpool:/bitcoin$ ll
total 1420
drwxrwxr-x 14 terry terry 4096 Mar 6 16:59 ./
drwxr-xr-x 23 terry terry 4096 Mar 6 16:43 ../
-rw-rw-r-- 1 terry terry 56106 Mar 6 16:59 aclocal.m4
-rwxrwxr-x 1 terry terry 527 Mar 6 16:42 autogen.sh*
drwxr-xr-x 2 terry terry 4096 Mar 6 16:59 autom4te.cache/
drwxrwxr-x 3 terry terry 4096 Mar 6 16:59 build-aux/
-rw-rw-r-- 1 terry terry 163272 Mar 6 16:59 config.log
-rwxrwxr-x 1 terry terry 1011199 Mar 6 16:59 configure*
-rw-rw-r-- 1 terry terry 48531 Mar 6 16:42 configure.ac
drwxrwxr-x 17 terry terry 4096 Mar 6 16:42 contrib/
-rw-rw-r-- 1 terry terry 13886 Mar 6 16:42 CONTRIBUTING.md
-rw-rw-r-- 1 terry terry 1142 Mar 6 16:42 COPYING
drwxrwxr-x 2 terry terry 4096 Mar 6 16:43 db4/
drwxrwxr-x 6 terry terry 4096 Mar 6 16:42 depends/
drwxrwxr-x 4 terry terry 4096 Mar 6 16:42 doc/
drwxrwxr-x 8 terry terry 4096 Mar 6 16:42 .git/
-rw-rw-r-- 1 terry terry 35 Mar 6 16:42 .gitattributes
drwxrwxr-x 2 terry terry 4096 Mar 6 16:42 .github/
-rw-rw-r-- 1 terry terry 1515 Mar 6 16:42 .gitignore
-rw-rw-r-- 1 terry terry 161 Mar 6 16:42 INSTALL.md
-rw-rw-r-- 1 terry terry 295 Mar 6 16:42 libbitcoinconsensus.pc.in
-rw-rw-r-- 1 terry terry 11091 Mar 6 16:42 Makefile.am
-rw-rw-r-- 1 terry terry 46839 Mar 6 16:59 Makefile.in
-rw-rw-r-- 1 terry terry 3600 Mar 6 16:42 README.md
drwxrwxr-x 5 terry terry 4096 Mar 6 16:42 share/
drwxrwxr-x 21 terry terry 4096 Mar 6 16:59 src/
drwxrwxr-x 4 terry terry 4096 Mar 6 16:42 test/
-rw-rw-r-- 1 terry terry 6959 Mar 6 16:42 .travis.yml
drwxrwxr-x 2 terry terry 4096 Mar 6 16:42 .tx/
terry@rootminingpool:
/bitcoin$

@jazap

This comment has been minimized.

Copy link

jazap commented May 31, 2018

Excellent work. How does one edit the qt client GUI interface?

@xiaoyue2019

This comment has been minimized.

Copy link

xiaoyue2019 commented Sep 3, 2018

Thanks for sharing, after the installation, the software language is garbled and I am getting an error:

If this sounds wrong, possibly the target language is not set or recognized.

what should I do?

@ashishcse0031

This comment has been minimized.

Copy link

ashishcse0031 commented Apr 13, 2019

Thanks!

@VladWeb-V

This comment has been minimized.

Copy link

VladWeb-V commented Oct 29, 2019

Кто может помочь? Делаю форк для своего сайта, пытаюсь скомпилировать namecoin-qt командой make, :
mkdir obj sudo apt-get install build-essential sudo apt-get install libssl-dev sudo apt-get install libboost-all-dev sudo add-apt-repository ppa:bitcoin/bitcoin sudo apt-get update sudo apt-get install libdb4.8-dev sudo apt-get install libdb4.8++-dev sudo apt-get install qt4-qmake libqt4-dev build-essential libboost-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-thread-dev libssl-dev libdb++-dev libminiupnpc-dev Сбилдим всё: sudo make -f makefile.unix USE_UPNP= cd .. sudo qmake sudo make

При использовании команды make пишет:
g++ -c -m64 -pipe -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild -o build/bitcoin.o src/qt/bitcoin.cpp make[1]: Вход в каталог /root/namecoin/src/leveldb'
make[1]: libleveldb.a' не требует обновления. make[1]: libmemenv.a' не требует обновления.
make[1]: Выход из каталога /root/namecoin/src/leveldb' g++ -c -m64 -pipe -fstack-protector-all -D_FORTIFY_SOURCE=2 -O2 -D_REENTRANT -fdiagnostics-show-option -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter -Wstack-protector -DQT_GUI -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_UPNP=1 -DSTATICLIB -DUSE_IPV6=1 -DHAVE_BUILD_INFO -DLINUX -D_FILE_OFFSET_BITS=64 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4 -Isrc -Isrc/json -Isrc/qt -Isrc/leveldb/include -Isrc/leveldb/helpers -Ibuild -Ibuild -o build/bitcoingui.o src/qt/bitcoingui.cpp In file included from src/walletdb.h:9:0, from src/wallet.h:19, from src/init.h:8, from src/qt/bitcoin.cpp:13: src/base58.h: In member function ‘bool CBitcoinAddress::IsValid() const’: src/base58.h:306:13: error: duplicate case value case SCRIPT_ADDRESS: ^ src/base58.h:302:13: error: previously used here case PUBKEY_ADDRESS: ^ src/base58.h:315:13: error: duplicate case value case SCRIPT_ADDRESS_TEST: ^ src/base58.h:311:13: error: previously used here case PUBKEY_ADDRESS_TEST: ^ src/base58.h: In member function ‘CTxDestination CBitcoinAddress::Get() const’: src/base58.h:355:9: error: duplicate case value case SCRIPT_ADDRESS: ^ src/base58.h:349:9: error: previously used here case PUBKEY_ADDRESS: ^ src/base58.h:356:9: error: duplicate case value case SCRIPT_ADDRESS_TEST: { ^ src/base58.h:350:9: error: previously used here case PUBKEY_ADDRESS_TEST: { ^ In file included from src/walletdb.h:9:0, from src/wallet.h:19, from src/qt/bitcoingui.cpp:26: src/base58.h: In member function ‘bool CBitcoinAddress::IsValid() const’: src/base58.h:306:13: error: duplicate case value case SCRIPT_ADDRESS: ^ src/base58.h:302:13: error: previously used here case PUBKEY_ADDRESS: ^ src/base58.h:315:13: error: duplicate case value case SCRIPT_ADDRESS_TEST: ^ src/base58.h:311:13: error: previously used here case PUBKEY_ADDRESS_TEST: ^ src/base58.h: In member function ‘CTxDestination CBitcoinAddress::Get() const’: src/base58.h:355:9: error: duplicate case value case SCRIPT_ADDRESS: ^ src/base58.h:349:9: error: previously used here case PUBKEY_ADDRESS: ^ src/base58.h:356:9: error: duplicate case value case SCRIPT_ADDRESS_TEST: { ^ src/base58.h:350:9: error: previously used here case PUBKEY_ADDRESS_TEST: { ^ make: *** [build/bitcoin.o] Ошибка 1 make: *** Ожидание завершения заданий… make: *** [build/bitcoingui.o] Ошибка 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.