Skip to content

Instantly share code, notes, and snippets.

@gmhawash
Forked from ivanvanderbyl/gist:4222308
Last active January 2, 2016 10:59
Show Gist options
  • Save gmhawash/8293620 to your computer and use it in GitHub Desktop.
Save gmhawash/8293620 to your computer and use it in GitHub Desktop.
Upgrade Postgresql 9.1 to 9.3
# Add pg ppa to your respository list; go here: http://www.postgresql.org/download/
# For ubuntu percise (12.04)
# Add the file: /etc/apt/sources.list.d/pgdg.list and in it add:
deb http://apt.postgresql.org/pub/repos/apt/ YOUR_UBUNTU_VERSION_HERE-pgdg main
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 postgresql-contrib-9.3
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.3/bin/pg_upgrade -b /usr/lib/postgresql/9.1/bin -B /usr/lib/postgresql/9.3/bin -d /var/lib/postgresql/9.1/main/ -D /var/lib/postgresql/9.3/main/ -O "-c config_file=/etc/postgresql/9.3/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.3/main/postgresql.conf # change port to 5432
sudo service postgresql restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment