To use new versions of INSYS icom Router Management a PostgreSQL12 database has to be upgraded to PostgreSQL14. This guide shows how to install PostgreSQL12 and 14 in parallel and later migrate the data to the newer version.
2. Upgrade to PostgreSQL 14 on Ubuntu 20.04
PostgreSQL 14 is not native on Ubuntu20.04 so we have to add the repository manually and then install it.
Create the file repository configuration:
1
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
Import the repository signing key:
1
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Update the package lists:
1
sudo apt-get update
Install the latest version of PostgreSQL.
If you want to specify the version, use 'postgresql-XX' instead of 'postgresql' |
1
sudo apt-get -y install postgresql-14
3. Upgrade Database from PostgreSQL 12 to 14
Halt the old server
1
sudo systemctl stop postgresql.service
Change working directory
1
cd /tmp
Migrate configuration files
1
sudo -u postgres /usr/lib/postgresql/14/bin/pg_upgrade --old-datadir=/var/lib/postgresql/12/main --new-datadir=/var/lib/postgresql/14/main --old-bindir=/usr/lib/postgresql/12/bin --new-bindir=/usr/lib/postgresql/14/bin --old-options '-c config_file=/etc/postgresql/12/main/postgresql.conf' --new-options '-c config_file=/etc/postgresql/14/main/postgresql.conf'
Reconfigure server ports
1
2
sudo vim /etc/postgresql/14/main/postgresql.conf # Set port to 5432
sudo vim /etc/postgresql/12/main/postgresql.conf # Set port to 5433
Activate new server and verify version
1
2
sudo systemctl start postgresql.service
sudo -u postgres psql -c "SELECT version();"
Reset password for custom user
1
sudo -u postgres psql
1
postgres=# \password u4insysicomroutermgmt