Installing PostgreSQL 9.0 on Ubuntu 10.04

PostgreSQL 9.0 final was released on 2010/09/20 which I’ve been waiting for to begin playing with it and evaluating it. The mainline Ubuntu Lucid apt repositories only have 8.4. According to the package maintainer, Martin Pitt, the postgresql-9.0 package won’t be added until Ubuntu Natty. Thankfully, he setup a backports repo for Ubuntu that we can pull from.

This is a very quick and painless process. If you have not done so already, make your life easier by installing python-software-properties:

sudo apt-get install python-software-properties

Next up is adding the backports repo and updating apt:

sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update

UPDATE: In the comments, Jason Froebe points out that if you already have an earlier version of PostgreSQL installed, you can just upgrade it:

sudo apt-get upgrade

Finally install postgresql-9.0:

sudo apt-get install postgresql-9.0 libpq-dev

The libpq-dev package is for compiling wrappers/clients against libpq.

There you’re done!

Default config directory is: /etc/postgresql/9.0/main
Default data directory is: /var/lib/postgresql/9.0/main

  • Pingback: Tweets that mention Installing PostgreSQL 9.0 on Ubuntu 10.04 « Dctr Watson --

  • Bpo

    This installs libpq-dev for postgres 8.4, unless I’m mistaken…

    • Doctor Watson

      It installs the newest version that resides in Martin’s repos.

      If you try to install libpq-dev before adding his repos and updating, it will install the 8.4 from the official repos.

  • Pingback: How to install PostgreSQL 9 on Ubuntu Linux 10.04/10.10 | Jason L. Froebe - Tech tips and How Tos for Fellow Techies()

  • Jason L. Froebe

    If you already have an earlier version of PostgreSQL installed, you can just do an “sudo apt-get upgrade” or “sudo aptitude safe-upgrade” once the repository is added :)

    • Doctor Watson


      Updated the post.

    • Sakti Dwi Cahyono

      after that, i have 2 version postgres running. 8.4 and 9

      • Abc

         I faced the same problem, uninstalling both versions and installing postgresql 9 solves the problem.

    • Esteban Feldman

      This didn’t install 9.0 for me though

    • Andy Rossmeissl

      Or if you don’t want to upgrade *all* of your packages, just use “sudo apt-get install postgresql” — the “install” command performs an upgrade if a previous version is present.

  • Alessandro Dellanna

    Thank you. With your help I have successfully upgraded my postgres from 8.4 to 9. Thanks a lot

  • Pingback: Ubuntu – PostgreSQL failing with no error message | Coding Answers()

  • Guillermo | electric car app

    Thank you very much for this post! The installation worked out perfectly in Ubuntu server 10.10

  • Chau Laurent

    2011.06.02 France & Genève
    Merci docteur, cela glisse tout schuss sur Ubuntu 11.04. (en français)
    谢谢博士,在 Ubutnu11.04 上滑翔舒斯。(en chinois)
    To go with OpenERP…


    And how about installing postgres 9.0 on debian 4.0?

  • Pingback: Rian Shin's personal blog()

  • Pingback: Ubuntu – PostgreSQL failing with no error message - Admins Goodies()

  • Douglas Nantes Gualberto

    Does not work in Ubuntu ppc

  • Pingback: Link dump for September 7th | The Queue Incorporated()

  • Nathan Esquenazi

    Anyone who find this post useful may want to check out where we include similar installation notes but go further and take you step by step through setup and configuration tuning.

  • Bhaveshletter

    Thanks. Smooth installation guide.

    • Bhaveshletter

       also need to do following command for to connect db by pgadmin tool

      sudo -u postgres psql template1
      ALTER USER postgres with encrypted password ‘postgres';

  • Cjfontanelle

    Thank you so much – your advice was a huge help – now i just gotta learn how to use it – I’ve got a huge excel spreadsheet to configure to work with my website and any tips would be really appreciated – so once again thanks

  • Amrhedar


  • Van Wilson

    Thanks for these instructions.

    I had installed Martin’s Postgres 9.0.5 package for Ubuntu 10.4 Lucid (on a dev server where we need an LTS release), and I had to come back and install “libpg-dev” in order to in install the Perl module DBD::Pg
    However, “apt-get install libpg-dev” looks like it installed the 9.2 version of the libs.

    I have a web app that I migrated over to this server, and its Postgres routines are working, but will there be any issues that may come up from having a slightly newer dev library? 

    (The DBD::Pg install correctly indentified my Postgres as 9.0.5)

  • Pingback: Upgrade PostgreSql 8.4 to 9.1 | Programming Notes()

  • Victor Sabo

    Not so far I have found new cool tool to work with PostgreSQL on ubuntu — Valentina Studio. Its free edition can do things more than many commercial tools!!

    I very recommend check it.