How do I upgrade to Postgres 9.2?

Just recently, I've read that PostgreSQL 9.2 is released. My Ubuntu 12.04 has PostgreSQL 9.1.5 installed. How can I update to 9.2 version? I tried apt-get update and apt-get upgrade but no updates for PostgreSQL.


Solution 1:

Here's the instructions for adding the postgresql apt repository: https://wiki.postgresql.org/wiki/Apt

Quickstart

Import the repository key from http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc:

wget -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -

Edit /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace squeeze with the actual distribution you are using:

deb http://apt.postgresql.org/pub/repos/apt/ squeeze-pgdg main

Configure apt's package pinning to prefer the PGDG packages over the Debian ones in /etc/apt/preferences.d/pgdg.pref:

Package: *
Pin: release o=apt.postgresql.org
Pin-Priority: 500

Note: this will replace all your Debian/Ubuntu packages with available packages from the PGDG repository. If you do not want this, skip this step. Update the package lists, and install the pgdg-keyring package to automatically get repository key updates:

sudo apt-get update
sudo apt-get install pgdg-keyring

Once you've added that repository, you can do sudo apt-get install postgresql-9.2

Solution 2:

There is a new, official postgresql.org repository. It contains the newest versions of postgresql including 9.3 as of February 2014. Please read the detailed official instructions. For Ubuntu 12.04 I used:

sudo bash -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql-9.3 pgadmin3