sudo apt-get update && sudo apt-get upgrade
sudo apt-get install postgresql postgresql-contrib
Update password for default root postgres user
// This password uses for login the Linux System not for the Database Connection
sudo passwd postgres
Setup User and Password for Database connection
// switch to the postgres user that You just updated the password before
su - postgres
// change the password of the current default postgres user of database
psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'MY_PASSWORD';"
// Created Test DB
createdb mytestdb
// Connect to Test DB
psql mytestdb
// Database Connection
postgresql://postgres:MY_PASSWORD@localhost:5432/mytestdb?schema=public