Skip to content

Instantly share code, notes, and snippets.

@ivanvanderbyl
Created December 6, 2012 06:55
Show Gist options
  • Save ivanvanderbyl/4222308 to your computer and use it in GitHub Desktop.
Save ivanvanderbyl/4222308 to your computer and use it in GitHub Desktop.
Postgres 9.1 to 9.2 upgrade guide for Ubuntu 12.04
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2 postgresql-server-dev-9.2 postgresql-contrib-9.2
sudo su -l postgres
psql -d template1 -p 5433
CREATE EXTENSION IF NOT EXISTS hstore;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
service postgresql stop
/usr/lib/postgresql/9.2/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.2/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.2/main/ -O "-c config_file=/etc/postgresql/9.2/main/postgresql.conf" -o "-c config_file=/etc/postgresql/9.1/main/postgresql.conf"
logout # logout postgresql back to previous user
sudo apt-get remove postgresql-9.1
sudo vim /etc/postgresql/9.2/main/postgresql.conf # change port to 5432
sudo service postgresql restart
@ibussieres
Copy link

I did it this way (for 9.3), in an automated fashion.

https://gist.github.com/ibussieres/11262268

@borgesalkan
Copy link

Thanks @ibussieres. Upgraded to 9.3.

@lukaszbudnik
Copy link

Perfect! Works like a charm.

@syadlowsky
Copy link

Thanks!

Worked great...until I got to PostGIS. Check out this post for details on dealing with the simultaneous postgres 9.1->9.3, postgis 1.5->2.x upgrade: http://sorokine.blogspot.com/2013/11/upgrading-postgresql-91postgis-15-to.html

@railsfactory-kumaresan
Copy link

Thanks @ibussieres. It worked... Awesome

@dideler
Copy link

dideler commented Nov 2, 2014

Instructions for upgrading from 9.3 to 9.4: https://gist.github.com/dideler/60c9ce184198666e5ab4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment