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.1and 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!
This article can be found online at the Debian Administration website at the following bookmarkable URL:
This article is copyright 2006 amadis - please ask for permission to republish or translate.