Well, it's the whole question. I installed 9.1 before, but I need older version now and I haven't yet found out how to do that.

sudo apt-get install postgresql-8.4 

Seems to do the trick (well, not really a trick).

  • 1
    E: Package 'postgresql-8.4' has no installation candidate says my Ubuntu 13.04(06.18.2013) – ted Jun 18 '13 at 9:31

If the old version of PostgreSQL is not available in Ubuntu repositories see PostgreSQL Apt Repository:

This repository will integrate with your normal systems and patch management, and provide automatic updates for all supported versions of PostgreSQL throughout the support lifetime of PostgreSQL.


If you want to install PostgreSQL 8.4 in ubuntu in specific version like ubuntu 12 then Follow the steps:

  • Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository :

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main"> /etc/apt/sources.list.d/pgdg.list'

sudo apt-get install postgresql-8.4


It's 2019 and (at least with my actual Ubuntu 16 config) PG versions prior to 9.3 are not available to instal with apt-get. I've followed the instructions provided in this site and now I have PG 10.10 and 8.4 installed. Required steps are (extracted from the previous link):

1. Create and edit the PostgreSQL repository by running the command below:

~$ sudo vi /etc/apt/sources.list.d/pgdg.list

Press I on keyboard and add the below line into the file:

deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main

Press Esc on keyboard and followed by :wq to save the file.

2. Download & import the repository key:

~$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

3. Update your system:

~$ sudo apt-get update

4. Now you’re able to install PostgreSQL via below command:

~$ sudo apt-get install postgresql-8.4 pgadmin3

NOTE: I've omitted pgadmin3 because I had it installed before.

NOTE 2: The link doesn't mention but if you have another PG version installed, remember you'll have to change port in one of your installations:

~$ sudo updatedb
~$ locate postgresql.conf
~$ cp /etc/postgresql/8.4/main/postgresql.conf /etc/postgresql/8.4/main/postgresql.conf_yyyymmdd
~$ sudo vi /etc/postgresql/8.4/main/postgresql.conf

Find the entry that says: port = 5433 and change port number to new value. Save file (:wq) and restart your postgres.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.