Friday, October 9, 2009

Installing PostgreSQL 8.4 on Ubuntu Jaunty (9.04)

Inaugural post!

Ubuntu 9.04 (Jaunty Jackalope) includes PostgreSQL 8.3 via the expected apt-get install postgresql. This is great, but PostgreSQL 8.4.1 has a number of nice features that I want (WITH queries, for example). At first I was just going to wait for Ubuntu 9.10, which is coming very shortly, but I am impatient. It turns out there is a pretty easy "Ubuntu way" to get PostgreSQL 8.4 installed on 9.04 without a lot of headaches (like building from source). The solution is using Ubuntu PPAs.

Add the custom PPA for PostgreSQL to /etc/apt/sources.list:

deb http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main
deb-src http://ppa.launchpad.net/pitti/postgresql/ubuntu jaunty main

Get the key for these new sources:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8683D8A2

Update the package list:

sudo apt-get update

Install!

sudo apt-get install postgresql-8.4

PostgreSQL 8.4.1 will now be running, but on port 5433, not the standard 5432. I assume this was done so you can run 8.3 and 8.4 at the same time on Ubuntu 9.04. I only want 8.4.1, so I changed the port and restarted:

sudo sed -i.bak -e 's/port = 5433/port = 5432/' \
    /etc/postgresql/8.4/main/postgresql.conf

sudo /etc/init.d/postgresql-8.4 stop
sudo /etc/init.d/postgresql-8.4 start

These PPAs for PostgreSQL only exist because of Martin Pitt, who appears to be responsible for PostgreSQL on Ubuntu, so many thanks to him!

6 comments:

  1. Could you please, upload to launchpad postgresql 8.4.2 for ubuntu 9.04?

    ReplyDelete
  2. launchpad repository is broken; is there any easy way to contact Martin?

    ReplyDelete
  3. @نلسون: Sorry, I don't actually know Martin Pitt, I just linked to him.

    @Sam: no prob!

    @Никита Кокшаров: I'm just a user, not the provider of the package, so you'll have to ask elsewhere if you need 8.4.2.

    ReplyDelete
  4. Try the backports, it has 8.4 now

    deb http://archive.ubuntu.com/ubuntu jaunty-backports main universe multiverse restricted

    ReplyDelete
  5. I install postgresql in ubuntu 10.10,but in pgadmin there is no any recognised server..so may ai help please..!

    ReplyDelete