Installare PostgreSQL in Debian 11

Mattepuffo's logo
Installare PostgreSQL in Debian 11

Installare PostgreSQL in Debian 11

In questo articolo vediamo come installare il database PostgreSQL in Debian 11.

Per farlo aggiungeremo il repo ufficiale anzichè usare la versione standard.

Ecco i comandi da dare:

# curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /usr/share/keyrings/postgresql-keyring.gpg
# echo "deb [signed-by=/usr/share/keyrings/postgresql-keyring.gpg] http://apt.postgresql.org/pub/repos/apt/ bullseye-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list
# aptitude update
# aptitude install PostgreSQL
# aptitude install postgresql
# systemctl status postgresql

Se tutto è andato a buon fine dovreste avere il db attivo.

A questo punto dobbiamo creare una password per l'utente postgres, che è l'utente che dobbiamo usare per accedere al db:

# passwd postgres

Adesso colleghiamoci nel terminale con quell'utente e poi entriamo nel db:

$ su - postgres
Password: 

postgres@matte-server:~$ psql
psql (14.2 (Debian 14.2-1.pgdg110+1))
Digita "help" per avere un aiuto.

postgres=#

Enjoy!


Condividi

Commentami!