HomeHome ArchiveArchive

installing Postgis 2.0 under Debian wheezy

We’ll be using Postgis2.0 from UbuntuGIS, which has packages for a number of recent Ubuntu releases. Since Ubuntu precise has libc6 2.14 and Debian wheezy only 2.13 we fall back on Ubuntu oneiric for packages, which also has libc6 2.13.

However Postgis 2.0 in UbuntuGIS depends on a lot of llibraries which were in squeeze but live in wheezy under a higher version. Therefore we’ll install a lot of packages from Debian squeeze. Fortunately the libraries are versioned themselves and thus can be installed along the libraries from Debian wheezy.

Let’s go. Add the Debian squeeze sources:

# SRC="deb http://ftp.ch.debian.org/debian/ wheezy main"
# echo "$SRC" >> /etc/apt/sources.list

We’ll also add the security source, in case Debian releases a security update.

# SRC="deb http://ftp.ch.debian.org/debian/ wheezy main"
# echo "$SRC" >> /etc/apt/sources.list

You may want to replace ftp.ch.debian.org by a debian mirror nearer to you.

Now add the UbuntuGIS sources:

# SRC="deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu oneiric main"
# echo "$SRC" > /etc/apt/sources.list.d/ubuntugis.list

Now update and try to install postgis:

# apt-get update
# apt-get install postgresql-9.1-postgis

Create your database:

# sudo su
# su - postgres
$ psql postgres
postgres=# CREATE DATABASE your_db OWNER your_preferred_user:

Now add the postgis features to that database:

$ psql -d your_db -f /usr/share/postgresql/9.1/contrib/postgis-2.0/
$ psql -d your_db -f /usr/share/postgresql/9.1/contrib/postgis-2.0/spatial_ref_sys.sql

That should be it. Let’s hope it works.

A final warning: you are mixing multiple distributions here. This can lead to problems. Due to version conflicts upgrading packages can become very difficult.

Tomáš Pospíšek <tpo_hp@sourcepole.ch>

Serving multiple WFS-T with TinyOWS

Our favorite WFS-T server complement of UMN Mapserver is TinyOWS. We like the simplicity of it so much, that we packaged it for Ubuntu and added it to OSGeoLive. Installation is easy:

sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install tinyows

The simplicity is a little bit too much, when it comes to serve multiple WFS-T on the same server. There is only one configuration file, but we want a configuration for each service. There are solutions for that, but I never saw a documentation of the most elegant solution we found. It uses Apache rewrite capabilities to set the TINYOWS_CONFIG_FILE environment variable according to the called URL:

# URL rewriting
RewriteEngine On

# Forbid direct access
RewriteRule ^/cgi-bin/.*$ - [F]

# Rewrite /xxx to /cgi-bin/tinyows with TINYOWS_CONFIG_FILE=/etc/tinyows/xxx.xml
RewriteRule ^/(.+)$ /cgi-bin/tinyows [QSA,PT,L,E=TINYOWS_CONFIG_FILE:/etc/tinyows/$1.xml]

This configuration included in a virtual host declaration (wfs.example.com) serves your WFS-T on wfs.example.com/servicename.

Kursprogramm Frühjahr 2013

Sourcepole bietet Grundlagen- und Aufbau-Kurse für den Betrieb von Geodaten-Infrastrukturen auf der Basis von PostgreSQL/PostGIS und Quantum GIS an. Detaillierte Informationen zu den Kursen, die im Frühjahr 2013 stattfinden, entnehmen Sie bitte http://www.sourcepole.ch/kurse Die Anmeldung ist ab sofort online möglich. Wir freuen uns darauf Sie in Zürich begüssen zu können.