How to Install PostgreSQL 9.1 on Ubuntu 12.10 Linux


PostgreSQL is an object-relational database system that has the features of traditional commercial database systems with enhancements to be found in next-generation DBMS systems. This blog entry documents the installation process of the PostgreSQL database on Ubuntu Linux.


I have selected PostgreSQL 9.1 and Ubuntu Linux 12.10 32 bit. The installation process follows the apt-get install configure pattern.

Step 1: Verify that you do not already have PostgreSQL installed on your system

Run the following command in your console:

ps ax | grep postgres

If you get a response similar to the one below, then you have PostgreSQL installed.

Ss 0:00 postgres: writer process
Ss 0:00 postgres: wal writer process
Ss 0:00 postgres: autovacuum launcher process
Ss 0:00 postgres: stats collector process

Step 2: Install PostgreSQL on your system

Run the following commands in your console:

sudo apt-get update
sudo apt-get install postgresql-9.1

Step 3: Configure your postgresql password

sudo -u postgres psql template1
ALTER USER postgres with encrypted password 'your_password';
Press ctrl-d

Step 4: Configure MD5 authentication

sudo nano /etc/postgresql/9.1/main/pg_hba.conf

Update the

local all postgres

entry to

local all postgres md5

Step 5: Enable TCP/IP connections

sudo nano /etc/postgresql/9.1/main/postgresql.conf

Locate the line

#listen_addresses = 'localhost'

and change it to:

listen_addresses = 'localhost'

To allow other computers to connect to your PostgreSQL server replace ‘localhost’ with the IP Address of your server, or alternatively to ’′ to bind to all interfaces.

Step 6: Restart postgres

sudo service postgresql restart

Step 7: Congratulations – You have just installed PostgreSQL on Ubuntu. Share this fantastic news using one of the share buttons or leave a comment in the reply section below.


8 thoughts on “How to Install PostgreSQL 9.1 on Ubuntu 12.10 Linux

  1. Michael Mitchell (@m_i_c_h_a_e_l_m)

    In step 4, you tell us to replace

    local all postgres


    local all postgres md5

    However, in my system, I don’t have

    local all postgres

    I have

    local all postgres peer

    in two different places. Am I supposed to replace peer with md5 in both places?

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>