PostgresSQL for Ubuntu

20 Jan

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’;
template1=# \q

for version 8.4

sudo -u postgres psql postgres
psql (8.4.4)
Type “help” for help.

and then run the following commands:

postgres=# \password postgres
Enter new password:
Enter it again:

postgres=# \q

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…:)

Leave a comment

Posted by on January 20, 2013 in Uncategorized


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: