Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On an Ubuntu Server, version 8.4 of PostgreSQL Server is already installed. I have to install 8.2 on the same server.

I would prefer to install from a .DEB instead of compiling from source.

share|improve this question
up vote 3 down vote accepted

You can use hardy Ubuntu repository:

  • sudo echo "deb hardy universe" > /etc/apt/sources.list.d/hardy.list
  • sudo apt-get update
  • cd && apt-get source postgresql-8.2
  • sudo apt-get build-dep postgresql-8.2
  • sudo apt-get install libreadline-dev
  • cd postgresql-8.2-8.2.7/
  • vi debian/control, and change "libreadline5-dev" to "libreadline-dev"
  • dpkg-buildpackage
  • cd && sudo dpkg -i postgresql-8.2_8.2.7-1_i386.deb postgresql-client-8.2_8.2.7-1_i386.deb postgresql-contrib-8.2_8.2.7-1_i386.deb
  • rm /etc/apt/sources.list.d/hardy.list


# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 10.10
Release:    10.10
Codename:   maverick
# pg_lsclusters 
Version Cluster   Port Status Owner    Data directory                     Log file
8.2     main      5433 online postgres /var/lib/postgresql/8.2/main       /var/log/postgresql/postgresql-8.2-main.log
8.4     main      5432 online postgres /var/lib/postgresql/8.4/main       /var/log/postgresql/postgresql-8.4-main.log
share|improve this answer

Debian's postgresql packages are designed to be installable side by side, with pg_*cluster commands for controlling them, which makes installing from a .deb a great idea. Unfortunately it looks like hardy (8.04) was the last version of Ubuntu to package postgresql-8.2 (in universe), I'm certain that the libraries it was compiled against are different than what you've got now, and would probably conflict against what you have if you tried to just install the package.

The easiest way to rebuild the package would be to add deb-src lines to your sources for Hardy:

deb-src hardy universe
deb-src hardy-updates universe
deb-src hardy-security universe

Then, after an apt-get update, you should use apt-get build-dep postgresql-8.2 to install all the build dependencies. If something can't be found at all in Maverick, you're going to have to make a judgement call on whether the package changed its name and install it by hand, or build that package from source too. Once you have all the build dependencies installed, apt-get source --compile postgresql-8.2 will fetch the source and build debian packages for all of these, using the library versions found in Maverick.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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