Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Ubuntu 16.04 - Install PostgreSQL Routing Extension (pgRouting)

The pgRouting extension is an open source (GPLv2) extension of PostGIS and PostgreSQL in order to provide routing functionality.

PostgreSQL 10.x

If you installed PostgreSQL 10, you want to run this command:

sudo apt install postgresql-10-pgrouting

PostgreSQL 9.1 - 9.6

The command below works for versions 9.1 to 9.6, just replace the 6 if you want a lower version.

sudo apt install postgresql-9.6-pgrouting

Install Extension

Login as privileged user:

sudo -u postgres psql

Connect to the relevant database:

\connect my_gis_database;

Install the extension:

CREATE EXTENSION pgrouting;

Check Version:

SELECT pgr_version();
                pgr_version                
-------------------------------------------
 (2.6.0,v2.6.0,a6226c4,release/2.6,1.58.0)
(1 row)