Category Archives: Bitcoin

A short guide to building bitcoind and bitcoin-qt on Debian Jessie

Okay, I’ll start with the command-lines.  To deliver the first couple, you have to be root (or say ‘sudo’ at the beginning of the line if your system is set up that way)

echo ‘deb-src ftp://ftp.us.debian.org/debian/ sid main contrib non-free’ >> /etc/apt/sources.list

If you don’t have your browser open wide enough, that line may wrap, but you’re supposed to enter it all on one line before you hit return. This gets you access to the source code for packages for ‘sid’ which is the unstable version of debian.  That’s where the source code for the bitcoin clients live, for now at least.  This is as of December 2014, and may have changed by the time you read this.  Sid also has a binary, but you can’t use the sid binary with a jessie libc and kernel.  The good news is that sid has sources for this package that build just fine on jessie using jessie’s libc and interacting with jessie’s kernel.

Now, still as root (or with another sudo), type

apt-get update

 


This will let apt know about all the sid sources, which will be big news as far as it’s concerned.  Now go to the directory where you want all the files installed.  here is how I do it:

cd /home

ls

 


you should see your user home directory – a directory that has your username.  cd into it, then do

mkdir ./src

cd src

apt-get source bitcoin

 


The system will download a few archives and unpack a bunch of files.  Next do

apt-get build-dep bitcoin

apt-get –install-recommends install libbitcoin-dev

 


This will load all the packages from jessie that have to be installed on your system before bitcoin will build.  Strictly speaking, the second line is optional.  I’m including it because it’s a lot of related stuff that may not continue to be optional as the source code for bitcoind evolves.  Now, here is the last command (for now) that you have to issue as root.  Assuming your username is ‘lyle’ you’d type

chown -R lyle:lyle *bitcoin*

 


This is optional, and will make for more typing later, but I don’t like to build things as root.  Too much can go wrong.  So this command is to make your non-root account own all those files.  Obviously, if your username is ‘katherine’ you have a bit more typing to do to enter the equivalent line.  You are done being root for now, so save yourself some stress and exit the root session (or stop typing ‘sudo’ before all these commands). Next, as your regular account,

cd ~/src/bitcoin-0.9.3

 


Again, this is as of December 2014, and the version number may have changed by the time you read this. (Edit as of March 2015: the version number is now 0.10.0.) Now you are ready to start building.  Type

./autogen.sh

 


and wait a minute; the autoconfiguration stuff will figure out a whole bunch of things about your computer and environment and what is available to compile with, link to, and etc. It’ll print a bunch of messages, but if you have all the dependencies (in some version it understands) it shouldn’t hit an error. Next, type

./configure –with-incompatible-bdb

 


Bitcoin’s standard client uses a database format that no longer exists anywhere else; the version of the database you got when you installed your dependencies is much newer than the one the original client used.  So you’ll see a warning fly by about ‘wallets opened with this build will not be compatible.’

This is normal, at least for building on jessie.  What it means is you’ll be able to open any standard wallet, but when you do, the current version of the database software will change its format.  After that, the standard bitcoin client won’t understand that wallet anymore.

If this is unacceptable, then you have a much tougher build process ahead of you, because it is damnably hard to force  version downgrades to a version of the database that ancient on Debian Jessie without breaking all kinds of dependencies and packages that you care about a lot.  Anyway, I’m not covering that messy process.  Just be aware that the client you’re building isn’t standard.

This won’t affect your ability to spend your coins, receive coins, do transactions, etc.  If you ever need your coins in a standard wallet, you can get anything that uses a standard wallet, give it the keys from the wallet this client uses, then tell it to rescan, and it’ll find your coins and you’ll have them in a standard wallet.  Anyway, the above command tells your computer that you know about the database thing and are going ahead anyway.

The next command you enter is

make

 


This will kick off a build process that could take up to an hour, if your computer is an OLPC or an ARM or has less than a gigabyte or two of RAM.   If you have a nice desktop computer though, it ought to build in about six minutes.  When it’s done, enter the commands

cd src

ls *bitcoin*

 


If the two files bitcoind and bitcoin-cli are listed, that’s good.  There’ll be some other files listed here, but those are the important ones that you just built.  They are the daemon and the command-line client, respectively.  Now enter the two commands

cd qt

ls bitcoin-qt

 


If the computer lists the file ‘bitcoin-qt’, you’re golden.  That’s the graphical client. Enter the command

cd ~/src/bitcoin-0.9.3/src

 


Now you have to be root again.  Sorry, I know it’s stressful.  But we’re on the last leg of this thing now; we’re just going to copy some files to the places they ought to be on your system and make root own just those files.  As root, enter

chown root:root bitcoind

chown root:root bitcoin-cli

mv bitcoind /usr/bin/

mv bitcoin-cli /usr/bin/

cd qt

chown root:root bitcoin-qt

mv bitcoin-qt /usr/bin/

cd ../../share/pixmaps/

cp bitcoin*.xpm /usr/share/pixmaps/

chown root:root /usr/share/pixmaps/bitcoin*

cd ../../debian

cp bitcoin-qt.desktop /usr/share/applications/

chown root:root /usr/share/applications/bitcoin-qt.desktop

cd ../contrib/debian/manpages/

cp bitcoin*.1 /usr/share/man/man1/

chown root:root /usr/share/man/man1 bitcoin*

cp bitcoin*.5 /usr/share/man/man5/

chown root:root /usr/share/man/man5/bitcoin*

 


And at this point you are done.  You can stop being root now.  The bitcoin client is installed on your system.  And it was only about a thousand percent more annoying than just typing “sudo apt-get install bitcoin”. But if you really want annoying, start it up and watch it begin a 20-gigabyte blockchain download. Again, that’s as of December 2014, and it’ll be bigger by the time you read this.