sudo apt-get install postgresql postgresql-contrib
# updates the mirrors
sudo apt update
# installs postgresql and some additional utilities and functionalities
sudo apt install postgresql postgresql-contrib
# starts installed postgresql service
sudo systemctl start postgresql.service
# installation creates default user postgres with below you can connect with postgres user
sudo -i -u postgres
# type psql to access postgresql prompt
psql
# postgresql installation completed
sudo snap install postgresql96
yum install postgresql-server postgresql-contrib -y
postgresql-setup initdb
systemctl enable postgresql
sudo systemctl start postgresql
systemctl status postgresql