This week was a bit of a nightmare because I suffered a HDD crash on my laptop. Installing Ubuntu from new isn't a big deal and restoring my /home data is slow but straight forward. However, installing all my favourite previously installed packages from memory is just a pain and nearly impossible to get right. The solution is to keep a record of what's installed so that one can pull in these packages on a clean fresh install.
To dump out the installed packages on a system, use:
dpkg --get-selections > installed.log
To re-install these packages on a clean fresh install use:
sudo dpkg --set-selections < installed.log
and then run:
sudo apt-get -u dselect-upgrade
It's also helpful to keep a backup of any configuration settings, e.g. files in /etc. I hope this saves you some pain next time you hit this kind of problem!