PostgreSQL Update

Support Wissensdatenbank

Du bist hier:
Print

PostgreSQL Update from 14 to version 15 on Ubuntu

Please check in advance, what PostgreSQL version Plesk supports, before you do the update.

1. Log in to your server with SSH or your prefered method an run the following commands in the terminal:

apt install curl ca-certificates gnupg -y
install -d /usr/share/postgresql-common/pgdg
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.gpg] http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list
apt update
apt install postgresql-15

If you’re asked for the version, select: “current local version”. The system will otherwise install the old version anew.

 

2. Now we update all databases, roles etc. to the new version:

sudo -u postgres pg_upgradecluster 14 main

 

3. If everything was succesfull, you should be prompted to delete the old PostgreSQL cluster with the command:

pg_dropcluster 14 main

 

4. Now restart the service and check the output:

service postgresql restart 
pg_lsclusters

 

The output should be:

15  main    5432 online postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log

 

If the port is not at 5432, run the command:

sed -i 's/^port = .*/port = 5432/' /etc/postgresql/15/main/postgresql.conf

 

If the output is not as specified, run:

pkill -u postgres
rm -f /var/lib/postgresql/15/main/postmaster.pid
systemctl restart postgresql
pg_lsclusters

and check, if the output is correct by repeating step 4.

 

If Plesk can’t connect, open the file with the command:

nano /etc/postgresql/14/main/pg_hba.conf

and change:

local   all   all   md5

to

local all all peer

 

5. Go to Plesk > Tools & Settings > Database Servers > click on the Host name right of PostgreSQL > OK

The new version should now be installed.

War dieser Artikel hilfreich?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
Wie können wir diesen Artikel verbessern?
Please submit the reason for your vote so that we can improve the article.
Brauchst du Hilfe?
Related Post