Updating from PostgreSQL 9.1 to PostgreSQL 9.4

UCS-4.2 ships PostgreSQL 9.4 by default, while previous UCS versions (UCS 4.1 and UCS 3.3) shipped PostgreSQL 9.1 by default. When such systems are updated, however, the installed PostgreSQL version is retained.

The following steps are necessary on a UCS-4.2 system for updating PostgreSQL 9.1 to PostgreSQL 9.4

[ -f /usr/sbin/univention-pkgdb-scan ] && chmod -x /usr/sbin/univention-pkgdb-scan
service postgresql stop
rm -rf /etc/postgresql/9.4
apt-get install --reinstall postgresql-9.4

And then

pg_dropcluster 9.4 main --stop
service postgresql start
test -e /var/lib/postgresql/9.4/main && mv /var/lib/postgresql/9.4/main /var/lib/postgresql/9.4/main.old
pg_upgradecluster 9.1 main
ucr commit /etc/postgresql/9.4/main/*
chown -R postgres:postgres /var/lib/postgresql/9.4
service postgresql restart
[ -f /usr/sbin/univention-pkgdb-scan ] && chmod +x /usr/sbin/univention-pkgdb-scan
univention-install --yes univention-postgresql-9.4

Once the new database / data inventory has been verified, the PostgreSQL 9.1 data can be removed / the software package uninstalled:

pg_dropcluster 9.1 main --stop
apt-get purge postgresql-9.1
1 Like
Mastodon