Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question

3 Answers

up vote 17 down vote accepted

You can use this PPA:

(Martin Pitt is also the one maintaining the official Debian- and Ubuntu PostgreSQL packages.)

You need to explicitly install 9.2, it doesn't upgrade your existing packages:

sudo add-apt-repository ppa:pitti/postgresql 
sudo apt-get update
sudo apt-get install postgresql-9.2

(Note change to package name.)

See also:

share|improve this answer
Thanks buddy. Will there any bug can occur if I upgrade to 9.2? – Defensor Sep 11 '12 at 16:15
As with any upgrade you should read the release notes and test first, it's impossible to say if there will be bugs for you or not. – Jorge Castro Sep 11 '12 at 16:17
I run sudo add-apt-repository ppa:pitti/postgresql then sudo apt-get update and sudo apt-get upgrade then press Y. However, I checked the version of PostgreSQL still it's 9.1.5. – Defensor Sep 11 '12 at 16:25
postgres-9.2 is different package than postgress, you have to install it explicitely with sudo apt-get install postgress-9.2. The old version would still be there. – mrówa Sep 11 '12 at 17:17
@mrówa - Well if it does a different package, how can switch use of it? Running sudo -u postgres psql would initiate my 9.1.5. – Defensor Sep 12 '12 at 2:07
show 3 more comments

Try this:

sudo -u postgres psql --cluster 9.2/main 
share|improve this answer
I get this : Error: Invalid version specified with --cluster – Defensor Sep 12 '12 at 15:25
On Askubuntu the individual asking a question will see every answer without needing to be individually addressed. Similarly you will be notified of every comment on your answer. Welcome to the site! Do you have any suggestion about Defensor's version error message? – John S Gruber Oct 9 '12 at 19:57
1  
This is just wrong. He's asking how to upgrade, not to connect to a 9.2 cluster. – nilbus Jan 16 at 2:22
AS far as I know, ppa:pitti installs the 9.2 in parallel to 9.1 - it just runs on another port. try 'psql -p 5433'. – alfonx Feb 8 at 17:45

Issue with the accepted answer: there's a deprecation warning on using the ppa mentioned above. Here's the instructions they recommend 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

share|improve this answer
I already have PostgreSQL installed, doing this will conflict my current installed? – Defensor Feb 23 at 14:01
it will install in it's own folder for postgresql-9.2. If you find some of your commands (like pg_dump) point to postgresql-9.1 programs, you can change the symlink or just run the command from within the postgresql-9.2 directory. definitely back up databases before installing the new version just to be sure. – Danny Feb 23 at 16:58
I take issue with that deprecation warning, since the PPA goes up to Quantal and the newer repo doesn't. Both are late to Raring, which breaks the recommended script. – Tobu Apr 22 at 20:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.