Install the latest available version of PostreSQL (any other required using postgresql-VERSION)
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:# Import the repository signing key: sudo apt install curl ca-certificates sudo install -d /usr/share/postgresql-common/pgdg sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc # Create the repository configuration file: sudo sh -c 'echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' # Update the package lists: sudo apt update # Install the latest version of PostgreSQL: # If you want a specific version, use 'postgresql-16' or similar instead of 'postgresql' sudo apt -y install postgresql//www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt update sudo apt install postgresql
To check the version
sudo -u postgres psql -c "SELECT version();"
you should see something like that
PostgreSQL 16.3 (Debian 16.3-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
psql (16.3 (Debian 16.3-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:
– PostgreSQL Tutorial
– Linux downloads (Debian)
– Installing and Configuring PostgreSQL on Ubuntu
– PostgreSQL downgrade password encryption
– Learn PostgreSQL