wiki:UsersWikiPostGIS20Debian60pkg

Version 4 (modified by danielceregatti, 12 years ago) ( diff )

THIS IS A WORK IN PROGRESS!! DO NOT FOLLOW THIS YET

Steps for creating a "proper" Postgis 2.0 pacakge for Postgreql 9.1 on Debian Squeeze

I prefer to build in a chroot. Install debootstrap if you don't already have it. Change amd64 to i386 or whatever is necessary to suit your environment.

mkdir chroot
sudo debootstrap --arch=amd64 squeeze chroot http://ftp.debian.org/debian/
sudo mount --bind /proc chroot/proc
sudo mount --bind /sys chroot/sys
sudo mount --bind /dev chroot/dev
sudo mount --bind /dev/pts chroot/dev/pts
sudo cp /etc/mtab chroot/etc/
sudo chroot chroot /bin/bash

Since you are already root inside the chroot there's no need to use sudo going forward.

Configure locales in the chroot as things will break if this isn't done.

apt-get update
apt-get install locales
echo -e "en_US ISO-8859-1\nen_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen

Add the official Debian backports repo for and pin the packages to get postgresql 9.1 and its immediate dependencies.

cat >> /etc/apt/sources.list.d/backports.list <<EOF
deb http://backports.debian.org/debian-backports squeeze-backports main
EOF

cat >> /etc/apt/preferences.d/postgresql.pref <<EOF
Package: libpq5
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: libpq-dev
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-9.1
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-client-9.1
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-client-common
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-common
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-contrib
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-contrib-9.1
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-plperl-9.1
Pin: release o=Debian Backports
Pin-Priority: 1000

Package: postgresql-server-dev-9.1
Pin: release o=Debian Backports
Pin-Priority: 1000
EOF

apt-get update

Install the dependencies required for building everything. And yes, it's a lot of stuff.

Disclaimer: Not entirely sure all of these are needed, but it'd take a considerable amount of time to determine only what is need, so…

apt-get install build-essential postgresql-9.1 debhelper devscripts dh-make-perl autotools-dev flex bison libgeos-dev libproj-dev libssl-dev xsltproc docbook docbook-xsl default-jdk libpg-java fastjar libjts-java imagemagick libcunit1-dev dblatex libxml2-dev libgtk2.0-dev postgresql-server-dev-9.1 apt-file libclass-data-inheritable-perl alien doxygen swig ruby ruby-dev libpopt-dev libjson0-dev checkinstall proj-bin grass-dev libcurl4-dev libdap-dev libgif-dev libhdf4-alt-dev libhdf5-serial-dev libjasper-dev libjpeg-dev libltdl3-dev libmysqlclient-dev libnetcdf-dev libpng-dev libpq-dev libspatialite-dev libsqlite3-dev libxerces-c2-dev unixodbc-dev libgdal1-dev ant

Create a scratch directory to perform all the tasks and cd into it

mkdir scratch
cd scratch

Download the two patch files from this page into this scratch directory

Build a GEOS 3.3.3 package. I used the control files from wheezy.

wget http://ftp.us.debian.org/debian/pool/main/g/geos/geos_3.3.3.orig.tar.gz
tar xvf geos_3.3.3.orig.tar.gz
cd geos-3.3.3
wget http://ftp.us.debian.org/debian/pool/main/g/geos/geos_3.3.3-1.1.debian.tar.gz
tar xvf geos_3.3.3-1.1.debian.tar.gz
rm -f geos_3.3.3-1.1.debian.tar.gz
dpkg-buildpackage
cd ..

Install the GEOS dev packages. These are required to build Postgis 2.0

sudo dpkg -i 

Build Postgis 2.0. This uses the postgis 1.5.3 control files from squeeze. The two patches are applied here to fix an issue with the Postgis (a bad URL in java/jdbc/build.xml to the maven jar that ant requires for building), and to make the control files build the package.

wget http://postgis.org/download/postgis-2.0.1.tar.gz
tar xvf postgis-2.0.1.tar.gz
cd postgis-2.0.1
patch -p0 < ../postgis_maven.patch
wget http://ftp.de.debian.org/debian/pool/main/p/postgis/postgis_1.5.3-2.debian.tar.gz
tar xvfz postgis_1.5.3-2.debian.tar.gz
rm -f postgis_1.5.3-2.debian.tar.gz
patch -p0 < ../../postgis_debian-2.0.1.patch
rm -rf debian/source
dpkg-buildpackage
cd ..

Install the pacakges. This command line would install all packages created by this process. Obviously don't pick anything you don't really need. For example, I have no use for the GEOS ruby bindings or the Postgis java package.

sudo dpkg -i libgeos-3.3.3_3.3.3-1.1_amd64.deb libgeos-dbg_3.3.3-1.1_amd64.deb libgeos++-dev_3.3.3-1.1_amd64.deb libgeos-ruby1.8_3.3.3-1.1_amd64.deb libgeos-c1_3.3.3-1.1_amd64.deb libgeos-dev_3.3.3-1.1_amd64.deb libgeos-doc_3.3.3-1.1_all.deb libpostgis-java_2.0.1_all.deb postgis_2.0.1_amd64.deb postgresql-9.1-postgis_2.0.1_amd64.deb

Pull in deps

sudo apt-get -f install

Attachments (2)

  • postgis_debian-2.0.1.patch (2.3 KB ) - added by danielceregatti 12 years ago. Patch file for making the necessary changes to the postgis 1.5.3 control files that were used as a template for this process.
  • postgis_maven.patch (628 bytes ) - added by danielceregatti 12 years ago. Patch file for fixing the URL to the maven-ant-tasks.jar file that the ant build process downloads when building the Postgis java support.

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.