How To Install PostgreSQL 13 on Debian 11/10/9

  • Improvements from de-duplication of B-tree index entries — Space savings and performance gains from
  • Queries that use aggregates or partitioned tables gets improved performance.
  • Incremental sorting
  • Better query planning when using extended statistics
  • Parallelized vacuuming of indexes

Install PostgreSQL 13 on Debian 11/10/9

sudo apt update

sudo apt -y upgrade
sudo reboot

Step 2: Add PostgreSQL 13 repository to Debian 11/10/9

sudo apt update

sudo apt -y install gnupg2

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" |sudo tee  /etc/apt/sources.list.d/pgdg.list
$ cat /etc/apt/sources.list.d/pgdg.list

deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main

Step 3: Install PostgreSQL 13 on Debian 11/10/9

sudo apt update
sudo apt -y install postgresql-13 postgresql-client-13
sudo pg_ctlcluster 13 main start
$ sudo pg_ctlcluster 13 main status

pg_ctl: server is running (PID: 4209)

/usr/lib/postgresql/13/bin/postgres "-D" "/var/lib/postgresql/13/main" "-c" "config_file=/etc/postgresql/13/main/postgresql.conf"
$ systemctl status postgresql@13-main.service

● postgresql@13-main.service - PostgreSQL Cluster 13-main

Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor preset: enabled)

Active: active (running) since Fri 2020-10-30 11:27:01 CET; 2min 11s ago

Main PID: 4209 (postgres)

Tasks: 7 (limit: 4580)

Memory: 18.1M

CGroup: /system.slice/system-postgresql.slice/postgresql@13-main.service

├─4209 /usr/lib/postgresql/13/bin/postgres -D /var/lib/postgresql/13/main -c config_file=/etc/postgresql/13/main/postgresql.conf

├─4211 postgres: 13/main: checkpointer

├─4212 postgres: 13/main: background writer

├─4213 postgres: 13/main: walwriter

├─4214 postgres: 13/main: autovacuum launcher

├─4215 postgres: 13/main: stats collector

└─4216 postgres: 13/main: logical replication launcher



Oct 30 11:26:59 debian systemd[1]: Starting PostgreSQL Cluster 13-main...

Oct 30 11:27:01 debian systemd[1]: Started PostgreSQL Cluster 13-main.
$ sudo su - postgres

postgres@debian:~$ psql

psql (13.4 (Debian 13.4-1.pgdg110+1))

Type "help" for help.



postgres=#
postgres=# exit

postgres@debian:~$ createuser c4geeks

postgres@debian:~$ createdb testdb -O c4geeks



postgres@debian:~$ psql -l

List of databases

Name | Owner | Encoding | Collate | Ctype | Access privileges

-----------+----------+----------+-------------+-------------+-----------------------

postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |

template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +

| | | | | postgres=CTc/postgres

template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +

| | | | | postgres=CTc/postgres

testdb | c4geeks | UTF8 | en_US.UTF-8 | en_US.UTF-8 |

(4 rows)
postgres@debian:~$ psql testdb

psql (13.4 (Debian 13.4-1.pgdg110+1))

Type "help" for help.



testdb=#
testdb=# alter user c4geeks with password 'StrongDBPassw0rd';

ALTER ROLE
testdb=# \q

postgres@debian:~$ dropdb testdb

postgres@debian:~$ exit

logout

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ComputingPost

ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.