Search This Blog

Monday, January 13, 2014

Installing PostgreSQL on Ubuntu

Installation of latest version of PostgreSQL on Ubuntu is easy. Simply open a command prompt (Ctrl-Alt-T) and enter the following command.

$sudo apt-get install postgresql



Once done, we can see that the necessary files have been copied and the service started.



Next we need to set a password for the postgres user.

The commands for doing these are as follows

$sudo -u postgres psql postgres



On psql, enter the following commands

# \password postgres


You will be asked to enter the password again, and you are done. You may also want to change the default password for the Ubuntu postgres user. You can do that by entering the following command

$ sudo passwd postgres

and entering the new password


You can test the login by entering the following command and supplying the newly created password

$ su - postgres

Next step could be to allow network level users to login, which you can setup following my previous blog post "Setting up Postgresql for Accepting Password Connections".