How to Install Bitcoind and CLI on Ubuntu Linux

Here we will show you how to install bitcoind on an Ubuntu shell.

Before cryptogrind was built using Bitcore technology. We used Bitcoind for our Bitcoin applications.

For this example we are using Ubuntu version:

Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise

Install dependencies and add repositories

Firstly, you will need to add the dependencies to your machine and setup the apt-get repository. The following code will do this

sudo apt-get install build-essential 
sudo apt-get install libtool autotools-dev autoconf 
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 bitcoind 
mkdir ~/.bitcoin/ && cd ~/.bitcoin/ 

Create a config file

If there isn't a bitcoin.conf file at ~/.bitcoin (your home directory bitcoin folder) you need to create one.

We use vim editor:

vim bitcoin.conf 

Add the following code to this file. Obviously, change the credentials for username, password. If you want to run on live net instead of testnet,change testnet to 0.


Save and exit the config file.

Running bitcoind

Once this is done, you can start bitcoind with the following command:

bitcoind & 

The & at the end makes sure that you run the application in the background which doesn't lock your current command cli session.

Test it all works

You can test that it worked by issuing the command:

bitcoin-cli getinfo 

This should return something like below with information on the block count downloaded, your version, and balance etc. You will need to wait for the blockchain to download before issuing other commands on bitcoin-cli. The "blocks" : 575060 information shows how many blocks you havecurrently downloaded.

    "version" : 100100,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 68.59156385,
    "blocks" : 575060,
    "timeoffset" : 0,
    "connections" : 65,
    "proxy" : "",
    "difficulty" : 227267.24697978,
    "testnet" : true,
    "keypoololdest" : 1441805544,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""

Stopping bitcoind

If you want to stop bitcoind for any reason, you can do this:

sudo killall bitcoind 

That's it folks, let us know if you come across any issues and we'll be happy to help you. In a future article, we will explain how to use Node.js to connect to the bitcoind instance JSONRPC which will allow you to make all kinds of Bitcoin apps, such as faucets, wallets and more.

How to Install Bitcoind and CLI on Ubuntu Linux
Share this