Installing PostgreSQL
First step:
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
Second step:
logging in
sudo -u postgres psqlCreating user
$ sudo -u postgres createuser <username>
Creating Database
$ sudo -u postgres createdb <dbname>
Giving the user a password
$ sudo -u postgres psql psql=# ALTER USER <username> with encrypted password '<password>';
Granting privileges on database
psql=# GRANT ALL PRIVILEGES ON DATABASE <dbname> to <username> ;