PostGIS 2.1 install guide

Regina Obe and Leo Hsu

To toggle between full slide deck and individual, use the ESC key.

Use s key to see the slide notes.

These instructions apply to all the slides we'll be posting. Best experienced with Firefox or Chrome.

Created by Regina Obe and Leo Hsu / / /
Using RevealJS

Where to Get it?

There are many

Covered here:, but we'll repeat a bit.

For the Brave and fearless

Compile from source, of course.

The road may be hard and bumpy, but the reward is great.


Quickest and Newbie friendly

Homebrew seems to be another popular option


Downloads and instructions here:

  • Stable version: Get from Application Stackbuilder
  • Bleeding Edge including with SFCGAL 3D support and PostGIS 2.2 (built for PostgreSQL 9.2-9.4) - get from Winnie, the PostGIS windows build-bot.

RedHat EL, CentOS, Scientific Linux

RedHat EL, CentOS, Scientific Linux, Amazon Linux: Use PostgreSQL Yum repo:

Some instructions you might find useful: An almost Idiot's guide to Installing PostgreSQL 9.3, PostGIS 2.1, and pgRouting with Yum

Ubuntu and Debian

Most Popular OS - Boundless OpenGeo GIS Platform

Contains PostgreSQL, PostGIS, GeoServer, QGIS, OpenLayers, OpenLayers templates.

Create a database

Create a database if you don't have one already. No postgres database does not count, and please don't install PostGIS in postgres.

CREATE DATABASE presentation;

If your distribution did not come with raster or running with lower than PostgreSQL 9.1, Sorry, can't use CREATE EXTENSION. Go here

Extensions: Spatially enable your database

Connect to your database first and then run the below commands

CREATE EXTENSION fuzzystrmatch;
CREATE EXTENSION postgis_tiger_geocoder;
CREATE EXTENSION postgis_topology;

Other extensions commonly used or packaged with PostGIS

-- You'll see these more in PostGIS 2.2
CREATE EXTENSION postgis_sfcgal;
CREATE EXTENSION address_standardizer;
CREATE EXTENSION pointcloud_postgis;

No Extensions: Spatially enable your database

Connect to your database first preferably using psql and then run the following scripts which are usually located in /share/contrib/postgis-2.1 of your postgresql install.

\i postgis.sql
\i spatial_ref_sys.sql
-- if you happen to have raster and want it
\i rtpostgis.sql

For tiger geocoder, run the correct scripts Tiger geocoder install without extensions.

Verify install of PostGIS

SELECT postgis_full_version();

POSTGIS="2.1.3 r12547" GEOS="3.4.2-CAPI-1.8.2 r3921" PROJ="Rel. 4.8.0, 6 March 2012" 
 GDAL="GDAL 1.10.1, released 2013/08/26" LIBXML="2.9.1" LIBJSON="UNKNOWN" RASTER

Verify install of pgRouting

SELECT * FROM pgr_version();
 version |  tag   | build |  hash   | branch | boost
 2.0.0   | v2.0.0 | 3     | fbbaa2a | master | 1.54.0