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 update
Install the latest available version of PostreSQL (any other required using postgresql-VERSION)
sudo apt install postgresql
To check the version
sudo -u postgres psql -c "SELECT version();"
you should see something like that
PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
Now it’s time to change the password for default user
sudo -u postgres psql
sasha@raspberrypi:~ $ sudo -u postgres psql psql (16.1 (Debian 16.1-1.pgdg120+1)) Type "help" for help. postgres=# \password postgres
Enter the command \password postgres to supply/confirm a new password.
DONE. Now you can install pgAdmin4 or just use it
Resources:
– Linux downloads (Debian)
– Installing and Configuring PostgreSQL on Ubuntu
– PostgreSQL downgrade password encryption
– I would add this too “Install PostgreSQL on Linux and Windows“
– PostgreSQL Tutorial
– Learn PostgreSQL