PostgreSQL 9.3

09 Sep 2013

PostgreSQL 9.3 was released very recently, and there are now packages available for Ubuntu systems through the official postgresql.org repository. Postgres is available through the Ubuntu standard repositories, but it’s an older version (9.1 or even 8.4 if you’re on an older release.)

In order to access the packages, you need to import the GPG key that the packages are signed with:

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | \
  sudo apt-key add -

Now you need to add the repository to your machine’s list of sources. This command is for Ubuntu 12.04 (“precise”):

sudo echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> 
/etc/apt/sources.list.d/postgresql.list

This appends the source line for the postgresql repo to a file in the directory that apt expects to pull its sources from. In older releases of apt, I believe there was only the one main file, /etc/apt/sources.list, but now it’s considered more proper to add a file for your particular purpose in /etc/apt/sources.list.d instead of cluttering up the main file. This also makes it easier to upgrade the main file without destroying your changes.

Anyway, after this, all that needs be done is to run apt-get update to actually pull in and update the lists of available packages, and then install the packages you want, as normal. The new 9.3 version is available under the name postgresql-9.3, as might be expected.

Enjoy!