Ubuntu 9.04 (Jaunty Jackalope) includes PostgreSQL 8.3 via the expected apt-get install postgresql. This is great, but PostgreSQL 8.4.1 has a number of nice features that I want (WITH queries, for example). At first I was just going to wait for Ubuntu 9.10, which is coming very shortly, but I am impatient. It turns out there is a pretty easy "Ubuntu way" to get PostgreSQL 8.4 installed on 9.04 without a lot of headaches (like building from source). The solution is using Ubuntu PPAs.
Add the custom PPA for PostgreSQL to /etc/apt/sources.list:
deb http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main deb-src http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main
Get the key for these new sources:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8683D8A2
Update the package list:
sudo apt-get update
sudo apt-get install postgresql-8.4
PostgreSQL 8.4.1 will now be running, but on port 5433, not the standard 5432. I assume this was done so you can run 8.3 and 8.4 at the same time on Ubuntu 9.04. I only want 8.4.1, so I changed the port and restarted:
sudo sed -i.bak -e 's/port = 5433/port = 5432/' \ /etc/postgresql/8.4/main/postgresql.conf sudo /etc/init.d/postgresql-8.4 stop sudo /etc/init.d/postgresql-8.4 start
These PPAs for PostgreSQL only exist because of Martin Pitt, who appears to be responsible for PostgreSQL on Ubuntu, so many thanks to him!