How to install PostGIS 1.5 on Ubuntu 11.10 (oneiric) from source
Prerequisites
Several components are needed, which can either be built from source or installed from pre-built packages, as shown below.
Install prerequisite packages using:
sudo apt-get install build-essential postgresql-9.1 postgresql-server-dev-9.1 libxml2-dev libgeos-dev proj
Optional packages for testing PostGIS:
sudo apt-get install libcunit1-dev
Optional packages for building documentation:
sudo apt-get install xsltproc docbook-xsl imagemagick
(for building PDF documentation, add dblatex
, but expect a large download)
Build
Download, configure, build and install:
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 sudo make install
Documentation/comments
From the postgis-1.5.8
directory:
cd doc make sudo make install sudo 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.
sudo -u postgres createdb template_postgis sudo -u postgres psql -d template_postgis -c "UPDATE pg_database SET datistemplate=true WHERE datname='template_postgis'" sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql sudo -u postgres psql -d template_postgis -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis_comments.sql