sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
apt show postgresql
sudo apt install postgresql postgresql-contrib
sudo su - postgres
psql
\conninfo
sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'your_password';
host all postgres <ipaddress>/32 md5