The bitcoind package that is available in the universal Ubuntu repositories is a very old version. You could add the bitcoin PPA and then install bitcoind from that; this will get you a stable version of bitcoind that is at most a month or two old. But, if you're the extra careful type, it doesn't hurt your peace-of-mind to have built bitcoind from source yourself.
This tutorial assumes you've already built bitcoind from source. If you haven't done that, go ahead and do that now.
To get add-apt-repository, which we will use later to add the bitcoin PPA:
sudo apt-get install python-software-properties
Add the bitcoin PPA to get access to the libdb4.8++-dev package:
add-apt-repository ppa:bitcoin/bitcoin apt-get update
Now you can install all the dependencies:
apt-get install libboost-all-dev libdb4.8-dev libdb4.8++-dev
If you're reading this from the future, you may want to check with the readme file(s) to verify that you have all the required dependencies; they may have changed since this article was written.
Put the bitcoind binary that you built from the previous tutorial in the /usr/local/bin directory. Then add a symlink in /usr/bin:
ln -s /usr/local/bin/bitcoind /usr/bin/bitcoind
Before starting bitcoind, you'll want to create the bitcoin.conf configuration file:
cd ~/ mkdir .bitcoin cd .bitcoin vim bitcoin.conf
Add the following to bitcoin.conf:
server=1 daemon=1 testnet=1 rpcuser=UNIQUE_RPC_USERNAME rpcpassword=UNIQUE_RPC_PASSWORD
If you wish to use this installation on the regular bitcoin network, remove testnet=1.
Now you're ready to start bitcoind. Simply enter the following in your terminal:
If all is well, Bitcoin server starting should be printed to the terminal.
To view info about your bitcoind instance enter the following:
If you receive error: couldn't connect to server after starting bitcoind, you may need to simply wait a little bit for bitcoind to finish its pre-start checks.
To view a list of all available commands:
It's important to note that you may wish to take additional steps to secure your bitcoin installation. These steps may vary depending upon the purpose of the installation. I will cover this topic in future articles.