0

Upgrading to PostgreSQL 8.3 on Gentoo

Gentoo has taken a long time to unmask PostgreSQL 8.3 in Portage. Currently, the best version you can get is. 8.0.5, which, if you can tell, is pretty far away from 8.3.

This masking is largely due to the painful process of upgrading PostgreSQL (which usually involves dumping all your databases and restoring them afterwards). Here’s what I did to get 8.3 up and running.

First, make sure you backup all your databases:

pg_dumpall > postgres-backup.dump

Run the following commands as root. This will add entries to your /etc/portage/package.keywords file:

echo "dev-db/postgresql-base ~amd64" >> /etc/portage/package.keywords
echo "dev-db/postgresql-server ~amd64" >> /etc/portage/package.keywords
echo "virtual/postgresql-server ~amd64" >> /etc/portage/package.keywords
echo "virtual/postgresql-base ~amd64" >> /etc/portage/package.keywords

Make sure to replace amd64 with your actual architecture.

Now, we’re going to unemerge PostgreSQL so we can emerge the new version:

emerge --unmerge dev-db/postgresql dev-db/libpq

Emerge the new version, configure it, start it, and add it to startup:

emerge virtual/postgresql-base virtual/postgresql-server
emerge --config =dev-db/postgresql-server-8.3.5
/etc/init.d/postgresql-8.3 start
rc-update add postgresql-8.3 default

Make sure to replace the version above with the one you actually installed. Now restore your databases:

psql -U postgres -f postgres-backup.dump template1

And you should be all set.

Helpful Links:

PostgreSQL: Backup and Restore

Leave a Reply

Why ask?

Copyright © 2010 — phup 'n stuff | Site design by Trevor Fitzgerald