Skip to content

📚 PostgreSQL upgrade(Minor)

🔍 Prepare:

## OS and Software environment:

Environment name Version Download address
OS Rocky Linux 9.x Rocky Download
DB PostgreSQL 16.8 PostgreSQL Download(YUM Repository)

## Download below packages(Example PG 16.8):

Package name Download address
postgresql16-libs-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package
postgresql16-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package
postgresql16-server-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package
postgresql16-contrib-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package
postgresql16-devel-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package
postgresql16-plpython3-16.8-1PGDG.rhel9.x86_64.rpm Click Download RPM Package

1. Check Install postgres package

rpm -qa | grep postgresql

alt text

2. Check our version

psql -V

alt text

psql -p 5435 -c "select version();"

alt text

3. Upload our package , example upload to /pgdata/source/

alt text

4. Shutdown instance

ps -ef|grep pgdata

alt text

su - postgres
pg_ctl stop -D /pgdata/SID
pg_ctl stop -D /pgdata/ZEKAI
ps -ef|grep pgdata

alt text

5. Backup software folder(example on /usr/pgsql-16)

cp -rp /usr/pgsql-16 /usr/pgsql-16.$(date +%Y.%m.%d)_minorbackup
ll -d /usr/pgsql*

alt text

6. Install/Replace Package

rpm -ivh --replacefiles /pgdata/source/postgresql16-libs-16.8-1PGDG.rhel9.x86_64.rpm
rpm -ivh --replacefiles /pgdata/source/postgresql16-16.8-1PGDG.rhel9.x86_64.rpm
rpm -ivh --replacefiles /pgdata/source/postgresql16-server-16.8-1PGDG.rhel9.x86_64.rpm
rpm -ivh --replacefiles /pgdata/source/postgresql16-contrib-16.8-1PGDG.rhel9.x86_64.rpm
rpm -ivh --replacefiles /pgdata/source/postgresql16-devel-16.8-1PGDG.rhel9.x86_64.rpm
rpm -ivh --replacefiles /pgdata/source/postgresql16-plpython3-16.8-1PGDG.rhel9.x86_64.rpm
chown -R postgres. /usr/pgsql-16
ll /usr/pgsql-16

alt text

7. start Instance

su - postgres
pg_ctl start -D /pgdata/SID
pg_ctl start -D /pgdata/ZEKAI
ps -ef|grep pgdata

alt text

8. Check Version

psql -V

alt text

psql -p 5435 -c "select version();"

alt text