Skip to content

Instantly share code, notes, and snippets.

@mriddle
Last active August 29, 2015 13:56
Show Gist options
  • Save mriddle/8838982 to your computer and use it in GitHub Desktop.
Save mriddle/8838982 to your computer and use it in GitHub Desktop.
Upgrades postgres 9.1 to 9.3 with PostGIS 2.1 on Ubuntu (precise)
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee -a /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.3 postgresql-9.3-postgis-2.1 postgresql-contrib-9.3 libpq-dev postgresql-9.3-postgis-2.1
cd /tmp
sudo service postgresql stop
sudo -H -u postgres /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.1/main/postgresql.conf' \
-O ' -c config_file=/etc/postgresql/9.3/main/postgresql.conf'
sudo service postgresql start
@mriddle
Copy link
Author

mriddle commented Feb 10, 2014

To disable a pg cluster - change auto to disabled in /etc/postgresql/9.1/main/start.conf

Look at using pg_upgrade with --jobs and --links to speed up upgrade

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