Unofficial Debian packages of PostgreSQL with PostGIS support are now available from Fred McDavid.
If you want to stick to the official Debian packages for PostgreSQL, Bernhard Reiter explained the approach in December of 2001 on the PostGIS users mailing list. I used this procedure to successfully compile PostGIS 0.7.5 for PostgreSQL 7.3.4.
As the root user, you need to issue the following commands on the target system.
apt-get install postgresql-dev
apt-get build-dep postgresql
As your user, you can then get the source for PostgreSQL.
apt-get source postgresql
Once you have it, move into that directory and initiate the configuration of the PostgreSQL source.
$ cd postgresql-7.3.4/ $ ./debian/rules config
Now, you can change into the contrib/ directory of the PostgreSQL source tree and unpack PostGIS.
$ cd build-tree/postgresql-7.3.4/contrib/ $ tar -zxvf ~/src/postgis-0.7.5.tar.gz
Change into the PostGIS subdirectory and build the package.
$ cd postgis-0.7.5 $ make # make install
Update, October 26th. It’s been covertly brought to my attention that it’s no longer necessary to perform the following step.
Finally, some sed magic is necessary to run the included schema dumps against any database you want to PostGIS enable, as explained in the installation guide.
cat postgis.sql | sed -e 's!$libdir!/usr/lib!g' > postgis-lib.sql cat spatial_ref_sys.sql | sed -e 's!$libdir!/usr/lib!g' > spatial_ref_sys-lib.sql
Update, July 5th, 2006. It’s been two years, but PostGIS has finally be added to Debian GNU/Linux. Just fetch the postgis package from Sid. It ought to be in Etch when it’s released.