This article only applies to UCS 5.0.
UCS 5.0 ships PostgreSQL 11 by default, while UCS 4.3 shipped PostgreSQL 9.6 by default and UCS 4.2 shipped with PostgreSQL 9.4. When UCS 4.4 systems are updated, however, the installed PostgreSQL version is retained.
The following steps are necessary on a UCS-5.0 system for updating PostgreSQL 9.4 or PostgreSQL 9.6 to PostgreSQL 11
The following commands are one-liners. You can simply triple-click on a line to completely select it for easy copy-and-paste. But still: Always double-check your command prompt before issueing a command!
[ -f /usr/sbin/univention-pkgdb-scan ] && chmod -x /usr/sbin/univention-pkgdb-scan
service postgresql stop
rm -rf /etc/postgresql/11
apt-get install --reinstall postgresql-11
ucr set postgres11/autostart='yes'
systemctl unmask postgresql@11-main.service
pg_dropcluster 11 main --stop
service postgresql start
[ -e /var/lib/postgresql/11/main ] && mv /var/lib/postgresql/11/main /var/lib/postgresql/11/main.old
pg_lsclusters -h | grep -q '^9\.6 ' && pg_upgradecluster 9.6 main || pg_lsclusters -h | grep -q '^9\.4 ' && pg_upgradecluster 9.4 main
univention-install --yes univention-postgresql-11
ucr commit /etc/postgresql/11/main/*
chown -R postgres:postgres /var/lib/postgresql/11
[ ! -e /etc/postgresql/11/main/conf.d/ ] && mkdir /etc/postgresql/11/main/conf.d/ && chown postgres:postgres /etc/postgresql/11/main/conf.d/
service postgresql restart
[ -f /usr/sbin/univention-pkgdb-scan ] && chmod +x /usr/sbin/univention-pkgdb-scan
Then check the actual version that is used:
pg_lsclusters -h
11 main 5432 online postgres /var/lib/postgresql/11/main /var/log/postgresql/postgresql-11-main.log
Once the new database / data inventory has been verified, the PostgreSQL 9.6 and/or 9.4 data can be removed / the software package uninstalled:
pg_lsclusters -h | grep -q '^9\.6 ' && (pg_dropcluster 9.6 main --stop && service postgresql restart && apt-get purge postgresql-9.6) || pg_lsclusters -h | grep -q '^9\.4 ' && (pg_dropcluster 9.4 main --stop && service postgresql restart && apt-get purge postgresql-9.4)