Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to upgrade PostgreSQL server from 8.4 to 9.1 or above
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
# stop apache server if you need
# sudo /etc/init.d/apache2 stop
sudo -i -u postgres
pg_dumpall > dumpall_$(date +"%Y%m%d").pgdump
exit
sudo mv /var/lib/postgresql/dumpall_$(date +"%Y%m%d").pgdump ~/
sudo cp -r /etc/postgresql/8.4 /etc/postgresql/old
sudo apt-get install postgresql-9.1 -y
sudo pg_dropcluster --stop 9.1 main
sudo pg_upgradecluster 8.4 main
sudo pg_dropcluster 8.4 main
sudo /etc/init.d/postgresql stop
sudo cp -aRv /var/lib/postgresql/9.1/main /path/to/db
sudo rm -r /var/lib/postgresql/9.1/main
sudo nano /etc/postgresql/9.1/main/postgresql.conf
### edit data_directory
data_directory = '/path/to/db/main'
### end nano
sudo /etc/init.d/postgresql start
sudo /etc/init.d/apache2 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.