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.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!
Nice article!
[ Parent | Reply to this comment ]
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 | Reply to this comment ]
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 | Reply to this comment ]
apt-get build-dep [package_name]Better yet, use a pbuilder.
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
[ Parent | Reply to this comment ]
dh_install -plibpq-dev --sourcedir=debian/tmp
cp: impossÃÂvel fazer stat em `debian/tmp//usr/include/postgresql/8.2/server/catalog/pg_type.h' : Arquivo ou diretório não encontrado
dh_install: command returned error code 256
make: ** [binary-install/libpq-dev] Erro 1
debuild: fatal error at line 842:
[ Parent | Reply to this comment ]
seems to be broken (unpatching failed)
so the next call of
#fakeroot debian/rules binary
failes, too (see top of output: Patch XY is already applied.)
save your original postgresql-8.2-8.2.4 directory and restore from backup
before next compile run
mfg grv
[ Parent | Reply to this comment ]
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 | Reply to this comment ]