How to install PostGIS 2.1 on Ubuntu 14.04 LTS (trusty) from source


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.3 postgresql-server-dev-9.3 libgeos-c1 libgdal-dev libproj-dev libjson0-dev libxml2-dev libxml2-utils xsltproc docbook-xsl docbook-mathml

Build PostGIS

tar xfz postgis-2.1.8.tar.gz
cd postgis-2.1.8

A basic configuration for PostGIS 2.1, with raster and topology support:

sudo make install
sudo ldconfig
sudo make comments-install

Lastly, enable the command-line tools to work from your shell:

sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/shp2pgsql
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/pgsql2shp
sudo ln -sf /usr/share/postgresql-common/pg_wrapper /usr/local/bin/raster2pgsql

Spatially enabling a database

Connect to your database using pgAdminIII or psql, and use the commands to add the PostgreSQL extensions. To add PostGIS with raster support:


To add topology support, a second extension can be created on the database:

CREATE EXTENSION postgis_topology;

See also

Last modified 7 years ago Last modified on Jul 7, 2015, 2:43:06 PM
Note: See TracWiki for help on using the wiki.