Sometimes, you need a newer version of a package than is available in your debian/ubuntu install.
There’s a number of ways to do it, for example using tools such as Prevu, but here is the step by step process.
We are going to backport the latest version of Unbound from Ubuntu Jaunty (1.2.1 at the time of writing) to an Ubuntu Hardy system. As a prerequisite, we need the build-essential package installed as we are going to compile some software, we also need the fakeroot package in order to build debian packages:
aptitude install build-essential fakeroot
Firstly, we need to enable the Jaunty source repositories in our /etc/apt/sources.list file, and comment out the Hardy source repositories (any of the other lines beginning with deb-src). You should run aptitude update after this step:
deb-src http://ie.archive.ubuntu.com/ubuntu jaunty restricted main multiverse universe
The next step is to gather what we need to compile Unbound, the build dependencies:
apt-get build-dep unbound
Now, we retrieve the “debianised” source code for unbound:
apt-get source unbound
Then cd into the unbound source directory (it should be something like unbound-1.2.1) and run the following command:
dpkg-buildpackage -rfakeroot -b -uc -us
This will compile unbound and build the debian package in one go. The resultant package is deposited in the parent directory. You can install it by doing:
dpkg -i ../unbound_1.2.1-0ubuntu1_i386.deb
If all goes well you should be able to install this package on other i386 Ubuntu Hardy systems as needed.