This site is now 100% read-only, and retired.

Installing the latest PostgreSQL on stable

Posted by amadis on Thu 16 Mar 2006 at 10:34

If you want use PostgreSQL 8.1 on your stable Debian 3.1 it is not a problem. Here is a quick walkthrough of the required steps of rebuilding the Debian package for Sarge.

Fist of all, you must download debianized sources. The mainstream version of PostgreSQL does not contain a debian directory, which contains the necessary debian-specific scripts, so you can download sources from official debian site. Go to

http://packages.debian.org/unstable/misc/postgresql-8.1

and scroll page to its bottom. You can see string, begins with 'Source Package:'. Download two files, ended by '.orig.tar.gz' and '.diff.gz'. First one - original, mainstream source file, second - patch to debianize mainstream. In my case they are postgresql-8.1_8.1.3.orig.tar.gz and postgresql-8.1_8.1.3-1.diff.gz

To compile it, you must install some development tools:

apt get install patch build-essential devscripts

Untar source file and apply debian patch to it:

tar zxvf postgresql-8.1_8.1.3.orig.tar.gz
zcat postgresql-8.1_8.1.3-1.diff.gz | patch -p0

Go to directory postgresql-8.1-8.1.3. You can see here original source file postgresql-8.1.3.tar.bz2 (yes, archive from packages.debian.org contains another archive), some other files and directory named debian.

You can try to compile postgresql (first try):

debuild

At now, I think you get some error messages. Last string will be 'dpkg-buildpackage failed!'. Do not worry, you have not some build dependencies. Look at string begins with 'dpkg-checkbuilddeps:' - here you can see package names, which are not present at your system, but necessary to build postgresql. So, install all of it. In my case, I type such command:

apt-get install cdbs bison libperl-dev tk8.4-dev flex libreadline5-dev
apr-get install libssl-dev libpam0g-dev libxml2-dev libkrb5-dev
apt-get install libxslt1-dev python-dev bzip2

Some of this packages require even more packages, so you download time may vary.

If you install all required packages, you can try to compile and package postgresql one more time:

debuild

After some waiting you can install your own postgresql package. It located in upper directory:

cd ..
ls -l

But before you have to install some additional packages:

apt-get install lsb-common

because postgresql-common depends on it and download and install postgresql-common from 'http://packages.debian.org/unstable/misc/postgresql-common'.

dpkg -i postgresql-common_43_all.deb

After that you can install postgresql:

dpkg -i libpq4_8.1.3-1_i386.deb
dpkg -i postgresql-client-8.1_8.1.3-1_i386.deb
dpkg -i postgresql-8.1_8.1.3-1_i386.deb

Well done! My congratulations!

 

 


Re: Installing the latest PostgreSQL on stable
Posted by Anonymous (81.208.xx.xx) on Thu 16 Mar 2006 at 11:59
There is an easiest way to exctract the debianized source: simply download the .dsc in the same directory of the .tar.gz and the .diff.gz and then run "dpkg-source -x filename.dsc". That's all, you have the source tree with all patch applied and the "debian/" subdir ready for compiling.

Nice article!

[ Parent ]

Re: Installing the latest PostgreSQL on stable
Posted by joostje (193.173.xx.xx) on Thu 16 Mar 2006 at 12:51
Doesn't this work?
  apt-get source packagename/unstable
(no access to a debian machine right now, so I cannot test it).
You will need source lines in your apt prefs.

[ Parent ]

Re: Installing the latest PostgreSQL on stable
Posted by shufla (83.16.xx.xx) on Thu 16 Mar 2006 at 16:15
Hello,

Well, if you do not want to compile it yourself or to have updates made by backports.org you can use them, instructions are here: http://www.backports.org/instructions.html

And then: apt-get -t sarge-backports install postgresql-8.1 postgresql-client-8.1

Best Regards,
Luke Nowak

[ Parent ]

Re: Installing the latest PostgreSQL on stable
Posted by bmontgom (68.15.xx.xx) on Fri 17 Mar 2006 at 22:41
Install the package build depends with:
apt-get build-dep [package_name]
Better yet, use a pbuilder.

[ Parent ]

Re: Installing the latest PostgreSQL on stable
Posted by Anonymous (194.102.xx.xx) on Wed 15 Oct 2008 at 12:57
You have a little typo here :
apt-get install cdbs bison libperl-dev tk8.4-dev flex libreadline5-dev
apr-get install libssl-dev libpam0g-dev libxml2-dev libkrb5-dev
apt-get install libxslt1-dev python-dev bzip2
regards, Liviu

[ Parent ]