PostgreSQL even called simply Postgres, is an object-relational database management system (ORDBMS) available for many platforms such as Linux, FreeBSD, Solaris, Microsoft Windows, Mac OS X etc. It is a free and open source software.It is released under the PostgreSQL License, which is an MIT-style license.
And to have this software in your Ubuntu lets start with preparing the system.
1. First you need to install required libs from the following command:
sudo apt-get install libpq-dev
2. Open the terminal and run the following commands:
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update
sudo apt-get install postgresql-9.2
Now we are ready to Setup a Local PostgreSQL and pgAdmin. now we need to reset the password for the ‘postgres’ admin account for the server.Try to keep a strong password. Replace ‘password’ with the password you want to have. Run the following commands:
sudo su postgres -c “psql template1”
template1=# ALTER USER postgres WITH PASSWORD ‘password’;
for version 8.4
sudo -u postgres psql postgres
Type “help” for help.
and then run the following commands:
postgres=# \password postgres
Enter new password:
Enter it again:
That alters the password within the database, now we need to do the same for the unix user ‘postgres’. Make sure you use the password you entered inside of psql.
sudo passwd -d postgres
sudo su postgres -c passwd
Restart the PostgreSQL server.
sudo /etc/init.d/postgresql-8.3 restart
If you are done till now then yipee we are ready to use both pgAdmin and command-line access (as the postgres user) to run the database server.Hope It will be beneficial for you.Lets get started…:)