Skip to content

Instantly share code, notes, and snippets.

View kane-c's full-sized avatar

Kane kane-c

View GitHub Profile
@kane-c
kane-c / upgrade_pg.sh
Last active August 29, 2015 14:00 — forked from ibussieres/upgrade_pg.sh
Upgrade PostgreSQL 9.1 to 9.3 on Ubuntu 14.04
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS hstore;'"
sudo su - postgres -c "psql template1 -p 5433 -c 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";'"
sudo su - postgres -c "service postgresql stop"
sudo su - postgres -c '/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"'
sudo apt-get remove postgresql-9.1 postgresql-client-9.1 -y
sudo sed -i "s:5433:5432:g" /etc/postgresql/9.3/main/postgresql.conf
sudo service postgresql restart
sudo su - postgres -c '~/analyze_new_cluster.sh'