It is very simple to install postgreSQL in Ubuntu. Just run the following command in the command prompt
sudo apt-get install postgresql
This will install the latest postgreSQL and Now your are ready to use it.
But lets do some important configurations (that I did). The PostgreSQL configuration files are stored in the /etc/postgresql//main directory. In my case, I install PostgreSQL 8.3. So there are in /etc/postgresql/8.3/main
1. Enable TCP/IP connections
By default, connection via TCP/IP is disabled. PostgreSQL supports multiple client authentication methods. By default, IDENT authentication method is used for postgres and local users
To enable TCP/IP connections, edit the file /etc/postgresql/8.3/main/postgresql.conf
Locate the line #listen_addresses = ‘localhost’ and uncomment it.
To allow other computers to connect to your PostgreSQL server replace ‘localhost’ with the IP Address of your server.
2. Set a password for the postgres user
Run the following command at a terminal prompt to connect to the default PostgreSQL template database
sudo -u postgres psql template1
Then run following SQL command at the psql prompt to configure the password for the user postgres.
ALTER USER postgres with encrypted password ‘your_password’;
Remember to restart the PostgreSQL service to initialize the new configuration
Enter the following to restart
sudo /etc/init.d/postgresql-8.3 restart