Skip to content

Notes on Download, Installation and building pgRouting

Regina Obe edited this page Dec 5, 2022 · 26 revisions

Linux

If you are running linux but not sure which version the below command will tell you.

cat /etc/os-release 

Linux - Ubuntu/Debian, apt based

pgRouting on Ubuntu can be installed using packages in the main archive (Ubuntu 20.04) or Debian 11. Using a terminal window:

sudo apt install postgresql-12-pgrouting

If the above does not work, you can check which version of pgrouting and postgresql you have available with

sudo apt search pgrouting

pgRouting on Ubuntu and Debian can also be installed using packages from a PostgreSQL repository, which gives access to newer versions. More information can be found in: https://wiki.postgresql.org/wiki/Apt

Using a terminal window:

The distributions are called codename-pgdg. The codename can be obtained with:

$(lsb_release -cs)

Create /etc/apt/sources.list.d/pgdg.list.

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
  • Import the repository key, update the package lists

sudo apt install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt update
  • Install pgrouting based on your postgres Installation: for this example is 15
sudo apt install postgresql-15-pgrouting

This will also install all required packages such as PostgreSQL and PostGIS if not installed yet.

  • To be up-to-date with changes and improvements
sudo apt update && sudo apt upgrade

Linux - Centos/Redhat EL/Fedora - yum based

The PostgreSQL Development Group maintains packages for yum based systems such as Centos/Redhat/Scientific Linux/ and Fedora at https://yum.postgresql.org. These always have newer pgRouting than you can find in the main repositories.

The below is for a Redhat/CentOS7 based system and for PostgreSQL 15. You'll need to change the references to redhat and rhel-7 to your version.

sudo yum install epel-release 
# this will create a new repo file to pull updates from:

sudo tee /etc/yum.repos.d/pgdg.repo<<EOF
[pgdg-15]
name=PostgreSQL for 15 RHEL/CentOS 7 - x86_64
baseurl=https://download.postgresql.org/pub/repos/yum/15/redhat/rhel-7-x86_64/
enabled=1
gpgcheck=0

[pgdg-depends]
name=PostgreSQL RHEL/CentOS 7 - x86_64 common
baseurl=https://download.postgresql.org/pub/repos/yum/common/redhat/rhel-7-x86_64/
enabled=1
gpgcheck=0
EOF

sudo yum update && yum upgrade
# change the 15 to your PostgreSQL version
sudo yum install pgrouting_15

#for future updates do
sudo yum update && yum upgrade

Windows Production Builds:

Experimental binaries are available via PostGIS windows build bot (winnie) - https://postgis.net/windows_downloads Production builds are available via EDB Stackbuilder - PostGIS bundle and get installed when you install PostGIS.

  • Building from source

To get the dependencies, you can use the following script: makepgRoutingDependencies.sh

RedHat Fedora Centos

Use the following link to see the pgRouting version available on Fedora: https://koji.fedoraproject.org/koji/packageinfo?packageID=11212

FreeBSD

pgRouting can be installed via ports:

cd /usr/ports/databases/pgRouting
make install clean

or package:

pkg install pgrouting

OS X

Homebrew

brew install pgrouting

The installation command in is pretty much all one needs to do on macOS if homebrew is installed. The requirements can be installed via brew as well and are configured here: https://github.com/Homebrew/homebrew-core/blob/master/Formula/pgrouting.rb. Specific versions for pgrouting can't be chosen at the moment. The version defined in the formulas file will be installed. If specific versions are need to be, there is https://github.com/Homebrew/homebrew-versions.

Clone this wiki locally