sudo apt update
sudo apt install postgresql postgresql-contrib
sudo -i -u postgres
You can now access a Postgres prompt immediately by typing:
psql
sudo -u postgres psql
sudo -u postgres createuser --interactive
The script will prompt you with some choices and, based on your responses, execute the correct Postgres commands to create a user to your specifications.
Enter name of role to add: krishna
Shall the new role be a superuser? (y/n) y
sudo -u postgres createdb
\password