First, you'll need to download the source code for the latest release of bitcoin; you can view a list of releases here. You'll usually want to get the most recent stable release (which will just have numbers, no suffix).

An example of downloading the latest release at the time of writing this post:

cd /usr/local/src;\
wget https://github.com/bitcoin/bitcoin/archive/v0.9.2.tar.gz;

Extract the archive:

cd /usr/local/src
tar -zxvf v0.9.2.tar.gz

Dependencies

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, including the build dependencies:

apt-get install build-essential
apt-get install libtool autotools-dev autoconf
apt-get install libssl-dev
apt-get install libboost-all-dev libdb4.8-dev libdb4.8++-dev
apt-get install pkg-config

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.

Build

Finally, it's time to build:

cd /usr/local/src/bitcoin-0.9.2
./autogen.sh
./configure --with-cli=no --with-gui=no
make

This will take a little while. If you encounter errors during the build process, first try searching the bitcoin GitHub repo. 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.

After the build process has completed with no errors, you should end up with a bitcoind binary located at /usr/local/src/bitcoin-0.9.2/src/bitcoind. Now it's time to move on to installing bitcoind on Ubuntu.