How to install PostGIS 1.5 on Debian 6.0 (squeeze) from source
Prerequisites
Several components are needed, which can either be built from source or installed from pre-built packages, as shown below.
As root
(or prefix "sudo
", if available), install prerequisite packages using:
apt-get install proj postgresql-server-dev-8.4 libxml2-dev libgeos-dev
Optional packages for testing PostGIS:
apt-get install libcunit1-dev
Optional packages for building documentation:
apt-get install xsltproc docbook-xsl imagemagick
(for building PDF documentation, add dblatex
, but expect a large download)
Build
PostGIS can be built built from any user account:
wget http://download.osgeo.org/postgis/source/postgis-1.5.8.tar.gz tar xfvz postgis-1.5.8.tar.gz cd postgis-1.5.8 ./configure make
And as root
:
make install
Documentation/comments
From the postgis-1.5.8
directory:
cd doc make
and as root
:
make install make comments-install
Template
Complete a post-install by creating a template, which can be re-used for creating multiple spatially-enabled databases. Or if you just want to make one spatially enabled database, you can modify the commands for your needs.
Log-in as postgres
from root
using "su - postgres
", and use the following commands:
createdb template_postgis createlang plpgsql template_postgis psql -d template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis'" psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql psql -d template_postgis -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis_comments.sql