wiki:UsersWikiPostGIS20Debian60pkg

Version 1 (modified by danielceregatti, 9 years ago) (diff)

--

Steps for creating a "proper" Postgis 2.0 package 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
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 chroot chroot /bin/bash

Add the backports repo for postgresql 9.1 (Optional). I for one want to use modern software, so I chose to go with Postgresql 9.1 instead of 8.4 which is what squeeze defaults to.

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. Note that here I install the postgresql 9.1 files. YMMV if you use postgresql 8.4.

sudo 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 9 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 9 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