How to Upgrade Carbonio Community Edition to PostgreSQL 16 in RHEL 8 | Carbonio CE

The latest Carbonio CE 24.03 update adds support for PostgreSQL 16. Those who previously installed Carbonio on RHEL 8 using PostgreSQL 12 were faced with the need to update the distribution and version of PostgreSQL they were using to the current version. In this instruction, we will tell you how to do this.

Add a PostgreSQL 16 repository to the system:

dnf -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Install PostgreSQL 16 and create a default database in it

dnf install postgresql16 postgresql16-server
/usr/pgsql-16/bin/postgresql-16-setup initdb

Start the data update and migration procedure. For this:

  • Check cluster health and compatibility – su - postgres -c '/usr/pgsql-16/bin/pg_upgrade -b /usr/pgsql-12/bin/ -B /usr/pgsql-16/bin/ -d /var/lib/pgsql/12/data/ -D /var/lib/pgsql/16/data/ -c'
  • Stop PostgreSQL – systemctl stop postgresql-12.service
  • Start the update process – su - postgres -c '/usr/pgsql-16/bin/pg_upgrade -b /usr/pgsql-12/bin/ -B /usr/pgsql-16/bin/ -d /var/lib/pgsql/12/data/ -D /var/lib/pgsql/16/data/'
  • Make a backup of hba.conf file from the previous PostgreSQL version – mv /var/lib/pgsql/16/data/pg_hba.conf /var/lib/pgsql/16/data/pg_hba.conf_orig
  • Copy file hba.conf from the previous PostgreSQL version to the new one – cp /var/lib/pgsql/12/data/pg_hba.conf /var/lib/pgsql/16/data/pg_hba.conf
  • Set the necessary permissions for the copied file – chown postgres:postgres /var/lib/pgsql/16/data/pg_hba.conf
  • Boot a new version of the DBMS – systemctl start postgresql-16.service
  • Disable the old version of the DBMS – systemctl mask postgresql-12.service
  • Enable the use of the new DBMS version by default – systemctl enable postgresql-16.service

Check that all databases are listed in the PostgreSQL cluster you are using. If they have all migrated correctly, you can remove the unused PSQL clusters. To do this, run the commands:

su - postgres -c '/usr/pgsql-16/bin/vacuumdb --all --analyze-in-stages'
/var/lib/pgsql/delete_old_cluster.sh

Also update PGPool2:

dnf remove pgpool-II pgdg-redhat-repo
dnf install https://www.pgpool.net/yum/rpms/4.5/redhat/rhel-8-x86_64/pgpool-II-pg16-4.5.1-1pgdg.rhel8.x86_64.rpm

Post your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

How to Upgrade Carbonio Community Edition to PostgreSQL 16 in 22.04 | Carbonio CE
Flawless Email Migration: Innovative Roadmap for a Thrilling Transition | Carbonio CE