How to upgrade postgresql from 8.1 to 8.27 Print

  • 0

1. Print current webmin screens for posgresql: particularly allowed hosts (don't need to do this,
can use old pg_hba.conf copied to /var/lib/pgsql-oldversion in step 2)

2. Backup in as many ways as possible.

terminal:
ps postgres
cd /home/postgresql
pg_dumpall > oldversion_dumpall
exit

webmin:
backup important databases individually both as a tar file and sql file

terminal:
cp -R /var/lib/pgsql /var/lig/pgsql-oldversion

3. Stop database server

terminal:
service postgresql stop

4. remove postgresql rpms

terminal:
rpm -e `rpm -qa|grep postgresql*` --nodeps

5. remove database cluster

terminal:
rm -rf /var/lib/pgsql

6. instal new rpms

terminal:
rpm -ivh postgresql-libs-8.2.7-1PGDG.rhel5.i686.rpm
rpm -ivh postgresql-8.2.7-1PGDG.rhel5.i686.rpm
rpm -ivh postgresql-devel-8.2.7-1PGDG.rhel5.i686.rpm
rpm -ivh postgresql-contrib-8.2.7-1PGDG.rhel5.i686.rpm
rpm -ivh postgresql-server-8.2.7-1PGDG.rhel5.i686.rpm
rpm -ivh compat-postgresql-libs-4-1PGDG.rhel5.i686.rpm

7. init and start server

terminal:
service postgresql initdb
service postgresql start

8. set postgresql password

terminal:
su postgres
psql
alter user postgres with password 'YOUR_PASSWORD';
\q

9. edit config files if needed

10. set up allowed host in webmin, or copy over previous pg_hba.conf (of course back up new one)

11. if Step 9 and Step 10 are done, restart posgresql server

terminal:
service postgresql restart

12. restore databases, we did it through webmin with tar files from Step 2, but could be done from the dumpall.


Note: This went succesfully for us on a test server, no problems restoring data, and moving on. If you do run into a problem, be prepared to restore the old rpms,
and use dumpall or copy back the /var/lib/pgsql-oldversion. Will update for further clarifications after performing on live server, if need be.


Was this answer helpful?

« Back