https://www.postgresql.org/download/
Source
https://www.postgresql.org/ftp/source/
Download source archive
wget https://postgresql_some_version.tar.gz
Extract source
tar -xvzf archive.tar.gz
sudo apt install build-essential
cd source_dirctory
Instruction
.configure --without-readline --without-zlib
make
su
make install
adduser postgres
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su - postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test
https://www.postgresql.org/docs/13/install-short.html
su postgres
psql
\?
or
psql --help
or
man psql