Install PostgreSQL on Ruspberry Pi Debian Buster

sudo sh -c 'echo "deb $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - | 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 14.3 (Debian 14.3-1.pgdg100+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit

If you decided to install PostgreSQL 12 (sudo apt install postgresql-12). skip it. Unfortunately, at the time of writing, I still could not find another solution to resolve the issue with SCRAM password encryption. If you skip this section right now, you can come later and complete ALL the steps listed below.

Find and replace scram-sha-256 with md5 in two files

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

Restart the server

sudo systemctl restart postgresql

Now it’s time to change the password for default user

sudo -u postgres psql

Enter the command \password postgres to supply/confirm a new password.

DONE. Now you can install pgAdmin4 or just use it

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

Leave a Reply

Your email address will not be published.