How to upgrade Postgres 8.4.x to 9.0.x

I've found a couple of manuals where this procedure is described, but I faced with the problem with postgres-libs which were required for my SVN.

so there is my way how to perfom upgrade

1. service postgresql stop
2. rsync -a -v --progress /var/lib/pgsql/ /var/lib/pgsql.old/ #this will backup everything
3. wget http://yum.pgrpms.org/reporpms/9.0/pgdg-centos-9.0-2.noarch.rpm
4. rpm -i pgdg-centos-9.0-2.noarch.rpm
5. /etc/yum.repos.d/CentOS-Base.repo and add 'exclude=postgresql*' to the [base] and [updates] sections
6. yum remove postgresql84*
7. rpm -e postgresql-libs --nodeps
8. yum install postgresql90 postgresql90-server postgresql90-libs postgresql90-contrib postgresql90-devel
9. service postgresql-9.0 initdb
10. export PATH=/usr/pgsql-9.0/bin:$PATH
11. su - postgres ; export PATH=/usr/pgsql-9.0/bin:$PATH ; pg_upgrade --old-datadir "/var/lib/pgsql.old/data" --new-datadir "/var/lib/pgsql/9.0/data" --old-bindir "/usr/bin" --new-bindir "/usr/pgsql-9.0/bin"
12. cp /var/lib/pgsql.old/data/pg_hba.conf /var/lib/pgsql/9.0/data/pg_hba.conf
13. service postgresql-9.0 start
14. vacuumdb --all --analyze-only

Have fun with new Psql version :)

No comments: