Thursday, 19 May 2011

Install PostgreSQL 8.2 on Ubuntu 10.04

Before installing PostgreSQL 8.2 on Ubuntu 10.04 you need to have “libkrb53”. For 64-bit processor you can install “libkrb53_1.6.dfsg.3~beta1-2ubuntu1.5_amd64.deb” and for 32-bit processor you can install “libkrb53_1.6.dfsg.3~beta1-2ubuntu1.8_i386.deb”. These two debian packages you can download depending upon your processor.

For my case, I've Ubuntu 10.04 32-bit OS. So, I've downloaded from following link:

After installing this debian package you need to add Hardy repository to apt-get sources. Because PostgreSQL 8.2 is not available in Ubuntu 10.04's repository.

Command to add Hardy repository:
sudo vim /etc/apt/sources.list.d/hardy.list

Add following lines to “hardy.list” file:
deb http://us.archive.ubuntu.com/ubuntu/ hardy universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy-updates universe
deb http://us.archive.ubuntu.com/ubuntu/ hardy-security universe

After saving the above file you've to update your repository using:
sudo apt-get update

And then:
sudo apt-get install postgres-8.2

Last command will install PostgreSQL 8.2 server and client packages to your system. But this is not the end, still you need to set password for your “postgres” user of PostgreSQL 8.2. For doing that you've to edit “pg_hba.conf” file for able to login using “postgres” username without any password.

    1.Open “pg_hba.conf” file in terminal:
    sudo vim /etc/postgresql/8.2/main/pg_hba.conf

    2. Find the following line in that file:
    local all postgres ident sameuser

    3. Change that line with the following line:
    local all postgres trust

    4. After saving that “pg_hba.conf” file come out from vim editor and restart your postgresql server:
    sudo /etc/init.d/postgresql-8.2 restart

    5. Then login with your postgres user using following command:
    psql -U postgres -p 5434 template1
    Note: In this command after “-p” you've to mention your port number where your installed
    PostgreSQL 8.2 is running. In my case it is 5434.

    6. Then change your “postgres” user's password using following SQL query:
    ALTER USER postgres with password 'password_string';

    7. After the above step you need to revert back your “pg_hba.conf” file which you've changed in sept 3 with the following line:
    local all postgres ident sameuser

    So, this is the end of the installation. Now you can enjoy the flavour of PostgreSQL 8.2 on Ubuntu10.04.
     

5 comments:

  1. If anyone getting problem to install PostgreSQL-8.2 through following command:

    sudo apt-get install postgres-8.2


    Then please use synaptic package manager for installing this.

    ReplyDelete
  2. sudo apt-get install postgresql-8.2

    ReplyDelete
  3. Thanks Ana... it was my mistake and I didn't notice also....!!!

    ReplyDelete