Installing PostgreSQL in Ubuntu

sudo apt-get install postgresql
sudo apt-get install pgadmin3

Now basic postgres server and gui client tool is installed

Let’s login to default user ‘postgres’ and add a password, Enter this command –

sudo -u postgres psql postgres

You get the psql command prompt and enter this command to add password for user ‘postgres’

postgres=# \password postgres

Then Ctrl + D to exit the postgres console


For additional contrib package

sudo apt-get install postgresql-contrib-9.1