How to install PostGIS 1.5 on Debian 6.0 (squeeze) from source


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)


PostGIS can be built built from any user account:

tar xfvz postgis-1.5.8.tar.gz
cd postgis-1.5.8

And as root:

make install


From the postgis-1.5.8 directory:

cd doc

and as root:

make install
make comments-install


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
Last modified 11 years ago Last modified on Nov 15, 2012, 1:08:33 PM
Note: See TracWiki for help on using the wiki.