Forked from martinseener/postgresql_9.1_to_9.3_on_ubuntu_debian
Last active
August 29, 2015 14:12
-
-
Save systemsoverload/f31f405932521541cedf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure you have the pgdg apt source configured ( https://wiki.postgresql.org/wiki/Apt ) | |
apt-get install postgresql-9.4 postgresql-server-dev-9.4 postgresql-plpython-9.4 postgresql-contrib-9.4 | |
# If you're feeling bold - YMMV | |
apt-get install --only-upgrade pgadmin3 | |
# Stop all running postgresql servers -- needed for migration of 9.3 data to 9.4 (pg_upgrade execution) | |
/etc/init.d/postgresql stop | |
# Must link conf file into data directory since it's expected there by pg_upgrade. | |
# Unfortunately, Ubuntu places it in /etc default (which complicates the upgrade) | |
ln -s /etc/postgresql/9.3/main/postgresql.conf /var/lib/postgresql/9.3/main/postgresql.conf | |
ln -s /etc/postgresql/9.4/main/postgresql.conf /var/lib/postgresql/9.4/main/postgresql.conf | |
# Run the pg_upgrade, but as the postgres user instead of root. | |
su postgres | |
cd ~postgres | |
/usr/lib/postgresql/9.4/bin/pg_upgrade -d /var/lib/postgresql/9.3/main -D /var/lib/postgresql/9.4/main -b /usr/lib/postgresql/9.3/bin -B /usr/lib/postgresql/9.4/bin -k -v | |
# Hopefully upgrade finished without error! In which case, we can start up PostgreSQL... | |
/etc/init.d/postgresql | |
# The new version of postgresql should be online at port 5433, verify that its up and running and has all of your data then... | |
pg_dropcluster 9.3 main | |
# Now just find and replace 5433 with 5432 in /etc/postgresql/9.4/main/postgresql.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment