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.
3 Answers
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
-
I already have PostgreSQL installed, doing this will conflict my current installed?– DefensorFeb 23, 2013 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.– DannyFeb 23, 2013 at 16:58
-
1I 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.– TobuApr 22, 2013 at 20:55
-
1Just for future reference, I was getting the error saying /var/lib/postgresql/9.2/main is not accessible or does not exist Solved it using
sudo apt-get remove --purge postgresql-9.2 postgresql-9.1
sudo apt-get install postgresql-9.2
– PankajJul 18, 2013 at 5:08 -
Note, piping into sudo is not recommended. On my system, that causes the sudo prompt to be hidden, making the entire command appear to hang indefinitely.– CerinApr 27, 2014 at 1:54
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
Try this:
sudo -u postgres psql --cluster 9.2/main
-
-
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? Oct 9, 2012 at 19:57
-
1This is just wrong. He's asking how to upgrade, not to connect to a 9.2 cluster. Jan 16, 2013 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'.– alfonxFeb 8, 2013 at 17:45