Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Postgres 16 #1532

Open
lmacielvieira opened this issue May 14, 2024 · 0 comments
Open

Upgrade to Postgres 16 #1532

lmacielvieira opened this issue May 14, 2024 · 0 comments
Assignees
Labels
infrastructure Hardware or infrastructure update

Comments

@lmacielvieira
Copy link
Contributor

Backup before install

pg_dump -h <host> -U <user_name> -d <database> -Fd -j 4 -f backup_directory > backup.log &

Remove older installed versions

sudo apt remove —purge postgresql-15 postgresql-client-15 postgresql-doc-15
sudo systemctl stop postgresql
sudo apt-get --purge remove postgresql-9.5
sudo apt autoremove

Install PostreSQL 16

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install postgresql-16 postgresql-client-16 postgresql-doc-16
sudo systemctl start postgresql@16-main
sudo systemctl enable postgresql@16-main

Set user before restore backup

sudo -u postgres psql
CREATE USER <user>;
ALTER ROLE <user> WITH SUPERUSER;
ALTER ROLE <user> CREATEDB;
ALTER ROLE <user> CREATEROLE;
ALTER ROLE <user> LOGIN;
CREATE DATABASE <db> OWNER <user>;
\q

Change settings

*ask me for further details
sudo systemctl reload postgresql

Restore backup

pg_restore -h <host> -U <user> -d <db> -j 4 -Fd backup_directory
@lmacielvieira lmacielvieira added the infrastructure Hardware or infrastructure update label May 14, 2024
@lmacielvieira lmacielvieira self-assigned this May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure Hardware or infrastructure update
Projects
None yet
Development

No branches or pull requests

1 participant