Install the postgres software by
$ sudo apt-get install postgresql postgresql-contrib libpq-dev
Set up your password
Goto the postgres prompt
$ sudo -u postgres psql
Inside that you can set the password for the DB user postgres
ALTER USER postgres PASSWORD 'YourPassword';
References:
xtremekforever.blogspot
postgresql-password-authentication-failed-for-user-postgres