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!

Share/Save/Bookmark


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 | Reply to this comment ]

Posted by joostje (193.173.xx.xx) on Thu 16 Mar 2006 at 12:51
[ Send Message ]
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 | Reply to this comment ]

Posted by shufla (83.16.xx.xx) on Thu 16 Mar 2006 at 16:15
[ Send Message ]
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 | Reply to this comment ]

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

[ Parent | Reply to this comment ]

Posted by amadis (212.110.xx.xx) on Mon 20 Mar 2006 at 14:23
[ Send Message ]
to run this command "You must put some 'source' URIs in your sources.list" as apt-get complains. And not source to stable, but unstable.

[ Parent | Reply to this comment ]

Posted by bacula (86.135.xx.xx) on Sat 25 Mar 2006 at 20:15
[ Send Message | View Weblogs ]
here is the one more good tutorial for postgresql and i really like this

check here

[ Parent | Reply to this comment ]

Posted by leandro (201.44.xx.xx) on Thu 15 Mar 2007 at 20:50
[ Send Message ]
I can't do that with 8.2:

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 ]

Posted by Anonymous (62.178.xx.xx) on Thu 31 May 2007 at 20:43
#fakeroot debian/rules clean

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 ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search