An almost idiot's guide to install PostgreSQL 9.5, PostGIS 2.2 and pgRouting 2.1.0 with Yum

If you already have a working PostgreSQL 9.5 install, and just want to skip to relevant sections, follow this list:

As a general note, these instructions are what I did for CentOS 7. For lower versions ther are some differences in packages you'll get. For example currently if you are installing on CentOS 6 (and I presume by extension other 6 family), you won't get SFCGAL and might have pgRouting 2.0 (instead of 2.1)

ADVERTISEMENT: Our upcoming book pgRouting: A PRACTICAL GUIDE focusing on pgRouting 2.1+ just went on preview sale. More details about the launch at BostonGIS: pgRouting: A PRACTICAL GUIDE now on sale

Installing PostgreSQL 9.5 from Yum repository

The list of latest PostgreSQL versions and repos for Fedora 20-22, Red Hat 5-7, CentOS 6-7, Oracle EL Linux 6-7, and Scientific Linux 5-7, Amazon Linux AMI are located at http://yum.postgresql.org/repopackages.php.

  1. Figure out which OS you are on. Note the PGDG repository 9.5 only has binaries for the aforementioned, though for lower versions you can still get 9.4, 9.3 etc..

    First run

    uname -a
    Mine happens to return: Linux centos7 3.10.0-327.4.4.el7.x86_64 #1 SMP Tue Jan 5 16:07:00 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux so I know its a 64-bit because of the X86_64 at the end.
    cat /etc/redhat-release
    Mine returns:
    CentOS Linux release 7.2.1511 (Core)
  2. Install the right rpms from http://yum.postgresql.org/repopackages.php for your platform (note the hyperlink url) since you'll need it for rpm addition. In our case:

    On my CentOS 7 ran:

    sudo rpm -ivh http://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-2.noarch.rpm
  3. To see all packages from pgdg95 do: sudo yum list | grep pgdg95 should give you entries that look something like below and the ones we want are marked with pgdg95.
    CGAL.x86_64                                4.7-1.rhel7                 pgdg95
    CGAL-debuginfo.x86_64                      4.7-1.rhel7                 pgdg95
    CGAL-demos-source.x86_64                   4.7-1.rhel7                 pgdg95
    CGAL-devel.x86_64                          4.7-1.rhel7                 pgdg95
    SFCGAL.x86_64                              1.2.2-1.rhel7               pgdg95
    SFCGAL-debuginfo.x86_64                    1.2.2-1.rhel7               pgdg95
    SFCGAL-devel.x86_64                        1.2.2-1.rhel7               pgdg95
    SFCGAL-libs.x86_64                         1.2.2-1.rhel7               pgdg95
    barman.noarch                              1.5.1-1.rhel7               pgdg95
    boxinfo.noarch                             1.4.0-1.rhel7               pgdg95
    check_postgres.noarch                      2.22.0-1.rhel7              pgdg95
    cstore_fdw_95.x86_64                       1.4-1.rhel7                 pgdg95
    cstore_fdw_95-debuginfo.x86_64             1.4-1.rhel7                 pgdg95
    cyanaudit95.noarch                         0.9.5-1.rhel7               pgdg95
    dbi-link.noarch                            2.0.0-3.rhel7               pgdg95
    emaj.x86_64                                1.2.0-1.rhel7               pgdg95
    emaj-debuginfo.x86_64                      1.1.0-1.rhel7               pgdg95
    gdal.x86_64                                1.11.0-4.rhel7              pgdg95
    gdal-debuginfo.x86_64                      1.11.0-4.rhel7              pgdg95
    gdal-devel.x86_64                          1.11.0-4.rhel7              pgdg95
    gdal-doc.noarch                            1.11.0-4.rhel7              pgdg95
    gdal-java.x86_64                           1.11.0-4.rhel7              pgdg95
    gdal-javadoc.noarch                        1.11.0-4.rhel7              pgdg95
    gdal-libs.x86_64                           1.11.0-4.rhel7              pgdg95
    gdal-perl.x86_64                           1.11.0-4.rhel7              pgdg95
    gdal-python.x86_64                         1.11.0-4.rhel7              pgdg95
    geoip95.noarch                             0.2.4-1.rhel7               pgdg95
    geos.x86_64                                3.5.0-1.rhel7               pgdg95
    geos-debuginfo.x86_64                      3.5.0-1.rhel7               pgdg95
    geos-devel.x86_64                          3.5.0-1.rhel7               pgdg95
    geos-python.x86_64                         3.5.0-1.rhel7               pgdg95
    ip4r95.x86_64                              2.0.2-2.rhel7               pgdg95
    ip4r95-debuginfo.x86_64                    2.0.2-2.rhel7               pgdg95
    libevent.x86_64                            2.0.22-1.rhel7              pgdg95
    libevent-debuginfo.x86_64                  2.0.22-1.rhel7              pgdg95
    libevent-devel.x86_64                      2.0.22-1.rhel7              pgdg95
    libevent-doc.noarch                        2.0.22-1.rhel7              pgdg95
    libpqxx.x86_64                             1:4.0.1-0.1.rhel7           pgdg95
    libpqxx-debuginfo.x86_64                   1:4.0.1-0.1.rhel7           pgdg95
    libpqxx-devel.x86_64                       1:4.0.1-0.1.rhel7           pgdg95
    mailchimp_fdw95.x86_64                     0.3.1-1.rhel7               pgdg95
    multicorn95.x86_64                         1.3.1-1.rhel7               pgdg95
    multicorn95-debuginfo.x86_64               1.3.1-1.rhel7               pgdg95
    nagios-plugins-pgactivity.noarch           1.25beta1-1                 pgdg95
    ogr_fdw95.x86_64                           1.0.1-1.rhel7               pgdg95
    ogr_fdw95-debuginfo.x86_64                 1.0.1-1.rhel7               pgdg95
    ora2pg.noarch                              16.2-1.rhel7                pgdg95
    orafce95.x86_64                            3.1.2-1.rhel7               pgdg95
    orafce95-debuginfo.x86_64                  3.1.2-1.rhel7               pgdg95
    pagila95.noarch                            0.10.1-1.rhel7              pgdg95
    pg_activity.noarch                         1.2.0-1.rhel7               pgdg95
    pg_catcheck95.x86_64                       1.0.0-1.rhel7               pgdg95
    pg_catcheck95-debuginfo.x86_64             1.0.0-1.rhel7               pgdg95
    pg_partman95.x86_64                        2.2.2-1.rhel7               pgdg95
    pg_partman95-debuginfo.x86_64              2.2.2-1.rhel7               pgdg95
    pg_qualstats95.x86_64                      0.0.7-1.rhel7               pgdg95
    pg_qualstats95-debuginfo.x86_64            0.0.7-1.rhel7               pgdg95
    pg_repack95.x86_64                         1.3.2-1.rhel7               pgdg95
    pg_repack95-debuginfo.x86_64               1.3.2-1.rhel7               pgdg95
    pg_stat_kcache95.x86_64                    2.0.2-1.rhel6               pgdg95
    pg_stat_kcache95-debuginfo.x86_64          2.0.2-1.rhel6               pgdg95
    pg_top95.x86_64                            3.7.0-3.rhel7               pgdg95
    pg_top95-debuginfo.x86_64                  3.7.0-3.rhel7               pgdg95
    pg_track_settings95.x86_64                 1.0.0-2.rhel7               pgdg95
    pgadmin3_95.x86_64                         1.22.0-1.rhel7              pgdg95
    pgadmin3_95-debuginfo.x86_64               1.22.0-1.rhel7              pgdg95
    pgadmin3_95-docs.x86_64                    1.22.0-1.rhel7              pgdg95
    pgagent_95.x86_64                          3.4.0-2.rhel7               pgdg95
    pgagent_95-debuginfo.x86_64                3.4.0-2.rhel7               pgdg95
    pgbackman.noarch                           1.1.0-1.rhel7               pgdg95
    pgbadger.noarch                            7.3-1.rhel7                 pgdg95
    pgbouncer.x86_64                           1.7-1.rhel7                 pgdg95
    pgbouncer-debuginfo.x86_64                 1.7-1.rhel7                 pgdg95
    pgbson95.x86_64                            1.0.1-1.rhel7               pgdg95
    pgbson95-debuginfo.x86_64                  1.0.1-1.rhel7               pgdg95
    pgcenter.x86_64                            0.2.0-1.rhel7               pgdg95
    pgcenter-debuginfo.x86_64                  0.2.0-1.rhel7               pgdg95
    pgcluu.noarch                              2.4-1.rhel7                 pgdg95
    pgdg-oraclelinux95.noarch                  9.5-2                       pgdg95
    pgdg-redhat95.noarch                       9.5-2                       pgdg95
    pgdg-sl95.noarch                           9.5-2                       pgdg95
    pgfincore95.x86_64                         1.1.2-2.rhel7               pgdg95
    pgfincore95-debuginfo.x86_64               1.1.2-2.rhel7               pgdg95
    pgmemcache-95.x86_64                       2.1.2-1.rhel7               pgdg95
    pgmemcache-95-debuginfo.x86_64             2.1.2-1.rhel7               pgdg95
    pgmp95.x86_64                              1.0.2-1.rhel7               pgdg95
    pgmp95-debuginfo.x86_64                    1.0.2-1.rhel7               pgdg95
    pgpool-II-95.x86_64                        3.4.3-3.rhel7               pgdg95
    pgpool-II-95-debuginfo.x86_64              3.4.3-3.rhel7               pgdg95
    pgpool-II-95-devel.x86_64                  3.4.3-3.rhel7               pgdg95
    pgpool-II-95-extensions.x86_64             3.4.3-3.rhel7               pgdg95
    pgpoolAdmin.noarch                         3.4.1-1.rhel7               pgdg95
    pgreplay.x86_64                            1.2.0-1.rhel7               pgdg95
    pgreplay-debuginfo.x86_64                  1.2.0-1.rhel7               pgdg95
    pgrouting_95.x86_64                        2.1.0-1.rhel7               pgdg95
    pgrouting_95-debuginfo.x86_64              2.1.0-1.rhel7               pgdg95
    pgsi.noarch                                1.2.0-1.rhel7               pgdg95
    pgsphere95.x86_64                          1.1.1-4.rhel7               pgdg95
    pgsphere95-debuginfo.x86_64                1.1.1-4.rhel7               pgdg95
    pgtap95.noarch                             0.95.0-1.rhel7              pgdg95
    pguri95.x86_64                             1.20150415-1.rhel7          pgdg95
    pguri95-debuginfo.x86_64                   1.20150415-1.rhel7          pgdg95
    pgxnclient.x86_64                          1.2.1-1.rhel7               pgdg95
    pgxnclient-debuginfo.x86_64                1.2.1-1.rhel7               pgdg95
    phpPgAdmin.noarch                          5.1-2.rhel7                 pgdg95
    plpgsql_check_95.x86_64                    1.0.2-1.rhel7               pgdg95
    plpgsql_check_95-debuginfo.x86_64          1.0.2-1.rhel7               pgdg95
    plproxy95.x86_64                           2.6-1.rhel7                 pgdg95
    plproxy95-debuginfo.x86_64                 2.6-1.rhel7                 pgdg95
    plr95.x86_64                               8.3.0.16-1.rhel7            pgdg95
    plr95-debuginfo.x86_64                     8.3.0.16-1.rhel7            pgdg95
    plsh95.x86_64                              1.20130823-1.rhel7          pgdg95
    plsh95-debuginfo.x86_64                    1.20130823-1.rhel7          pgdg95
    plv8_95.x86_64                             1.4.4-1.rhel7               pgdg95
    plv8_95-debuginfo.x86_64                   1.4.4-1.rhel7               pgdg95
    postcode_95.x86_64                         1.3.0-1.rhel7               pgdg95
    postcode_95-debuginfo.x86_64               1.3.0-1.rhel7               pgdg95
    postgis2_95.x86_64                         2.2.1-3.rhel7               pgdg95
    postgis2_95-client.x86_64                  2.2.1-3.rhel7               pgdg95
    postgis2_95-debuginfo.x86_64               2.2.1-3.rhel7               pgdg95
    postgis2_95-devel.x86_64                   2.2.1-3.rhel7               pgdg95
    postgis2_95-docs.x86_64                    2.2.1-3.rhel7               pgdg95
    postgis2_95-utils.x86_64                   2.2.1-3.rhel7               pgdg95
    postgresql94-jdbc.noarch                   9.4.1207-1.rhel7            pgdg95
    postgresql94-jdbc-javadoc.noarch           9.4.1207-1.rhel7            pgdg95
    postgresql95.x86_64                        9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-contrib.x86_64                9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-debuginfo.x86_64              9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-devel.x86_64                  9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-docs.x86_64                   9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-libs.x86_64                   9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-odbc.x86_64                   09.05.0100-1PGDG.rhel7      pgdg95
    postgresql95-odbc-debuginfo.x86_64         09.03.0400-1PGDG.rhel7      pgdg95
    postgresql95-plperl.x86_64                 9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-plpython.x86_64               9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-pltcl.x86_64                  9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-python.x86_64                 4.1.1-2PGDG.rhel7           pgdg95
    postgresql95-python-debuginfo.x86_64       4.1.1-2PGDG.rhel7           pgdg95
    postgresql95-server.x86_64                 9.5.0-2PGDG.rhel7           pgdg95
    postgresql95-tcl.x86_64                    2.0.0-1.rhel7               pgdg95
    postgresql95-tcl-debuginfo.x86_64          2.0.0-1.rhel7               pgdg95
    postgresql95-test.x86_64                   9.5.0-2PGDG.rhel7           pgdg95
    proj.x86_64                                4.8.0-2.rhel7               pgdg95
    proj-debuginfo.x86_64                      4.8.0-2.rhel7               pgdg95
    proj-devel.x86_64                          4.8.0-2.rhel7               pgdg95
    proj-epsg.x86_64                           4.8.0-2.rhel7               pgdg95
    proj-nad.x86_64                            4.8.0-2.rhel7               pgdg95
    python-argcomplete.noarch                  0.3.7-1.rhel7               pgdg95
    python-argh.noarch                         0.23.0-1.rhel7              pgdg95
    python-psycopg2.x86_64                     2.6.1-1.rhel7               pgdg95
    python-psycopg2-debuginfo.x86_64           2.6.1-1.rhel7               pgdg95
    python-psycopg2-doc.x86_64                 2.6.1-1.rhel7               pgdg95
    repmgr95.x86_64                            3.0.3-1.rhel7               pgdg95
    repmgr95-debuginfo.x86_64                  3.0.3-1.rhel7               pgdg95
    slony1-95.x86_64                           2.2.4-4.rhel7               pgdg95
    slony1-95-debuginfo.x86_64                 2.2.4-4.rhel7               pgdg95
    split_postgres_dump.noarch                 1.3.3-1.rhel7               pgdg95
    tail_n_mail.noarch                         1.27.0-1.rhel7              pgdg95
    tds_fdw95.x86_64                           1.0.7-1.rhel7               pgdg95
    tds_fdw95-debuginfo.x86_64                 1.0.7-1.rhel7               pgdg95
    usda-r18.noarch                            1.0-2.rhel7                 pgdg95
  4. We usually install the below. The devel is optional but needed if you want to compile some other add-on later like non-packaged extensions.

    yum install postgresql95 postgresql95-server postgresql95-libs postgresql95-contrib postgresql95-devel
  5. You should get a prompt something like:
    Dependencies Resolved
    
    ================================================================================
     Package                   Arch        Version                Repository   Size
    ================================================================================
    Installing:
     postgresql95              x86_64      9.5.0-2PGDG.rhel7      pgdg95      1.3 M
     postgresql95-contrib      x86_64      9.5.0-2PGDG.rhel7      pgdg95      526 k
     postgresql95-devel        x86_64      9.5.0-2PGDG.rhel7      pgdg95      1.7 M
     postgresql95-libs         x86_64      9.5.0-2PGDG.rhel7      pgdg95      213 k
     postgresql95-server       x86_64      9.5.0-2PGDG.rhel7      pgdg95      4.1 M
    Installing for dependencies:
     libxslt                   x86_64      1.1.28-5.el7           base        242 k
    
    Transaction Summary
    ================================================================================
    Install  5 Packages (+1 Dependent package)
    
    Total download size: 8.1 M
    Installed size: 34 M
    Is this ok [y/d/N]:
    Type: y

    It should then download the packages and install them with a Complete! exclamation when done.

If you need to configure things the way you want to configure things

Skip this section if you just want to run with defaults and will only have one instance of PostgreSQL

If you plan to run multiple versions of PostgreSQL e.g. stable 9.5 and devl 9.6, on the same server (so they use different ports), or you just need to be in control of all your options, you'll want to tweak your services scripts a bit. The best way to do that is to edit/create a file in /etc/sysconfig/pgsql/postgresql-9.5 with your preferred changes:

Note that # are remarks to you so don't type them in

su root
vi /etc/sysconfig/pgsql/postgresql-9.5

if the file doesn't exist -- it will be blank which is okay: Click i to insert a line and start typing. I generally like to run on non-standard ports just to avoid postgresql bots blindly pinging on 5432. You also need to run on different ports if you have multiple instances running on same server. So to change you can: Note: PGDATA you don't need to add unless you are unhappy with the default location.

My file when I am done will look something like this

PGPORT=5440
PGDATA=/pgdata95

Click Escape key followed by :w :q (:w saves the file and :q exits)

New versions you can once connected to system

Creating PostgreSQL data cluster and starting the service

With the Yum setup each version of postgresql goes in its own separate folder, so you can easily have parallel installs of different versions of PostgreSQL without worring about overriding the default data folder.

I'll reiterate the key elements and consequences of these changes you need to watch out for.

Changing password of system postgres account

Installing postgres creates a user account called postgres. If you want to change the password to something you know do this:

sudo passwd postgres

You'll be prompted for a new password.

Key Steps to setup

If you want the service to start up on reboot, then simply do this:

su root
service postgresql-9.5 initdb 

If you get an error:

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.

Do

/usr/pgsql-9.5/bin/postgresql95-setup initdb
service postgresql-9.5 start
chkconfig --list #(to see list of services)
chkconfig postgresql-9.5 on #(to have start on bootup)

For newer CentOS like 7+, use

systemctl list-unit-files #(to see list of services)

The data cluster is created by default in /var/lib/pgsql/9.5/data and the extensions folder is in /usr/pgsql-9.5/share/extension/ and the binaries are in /usr/pgsql-9.5/bin. To use psql, you can generally get away with just typing psql without the full path, but if you have multiple installations of PostgreSQL, you're better off being explicit which one you want.

For the rest of these exercises, we are going to assume you are just using the default ports etc.

Installing adminpack

To install the adminpack useful for viewing logs and editing postgresql.conf from the comfort of PgAdmin, don't forget to install the admin pack

su postgres
cd ~/
/usr/pgsql-9.5/bin/psql -p 5432 -c "CREATE EXTENSION adminpack;"

Installing PostGIS binaries

PostGIS unfortunately has a lot of dependencies because of GDAL and JSON dependency introduced in 2.0 and while some of the time it's as easy as adding:

If still under postgres switch back to root with exit.

sudo yum install postgis2_95 postgis2_95-client

The postgis2_95-client contains the PostGIS commandline tools shp2gpsql, pgsql2shp, raster2pgsql that are useful for loading or exporting spatial data.

It often is not. As with this virgin box we tried installing on we got these errors:

:
--> Finished Dependency Resolution
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libdapclient.so.3()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libdap.so.11()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libspatialite.so.2()(64bit)
Error: Package: postgis2_95-2.2.0-1.rhel6.x86_64 (pgdg95)
           Requires: hdf5
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libarmadillo.so.4()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libCharLS.so.1()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libgta.so.0()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libgeotiff.so.1.2()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libfreexl.so.1()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libdapserver.so.7()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libcfitsio.so.0()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libnetcdf.so.6()(64bit)
Error: Package: gdal-libs-1.9.2-7.rhel6.x86_64 (pgdg95)
           Requires: libhdf5.so.6()(64bit)

The issue is the dependency packages are not distributed with yum postgresql repo. Most of these are in the RHEL Extra Packages for Enterprise Linux (EPEL) repo. So if you get these errors, do the following:

Note that after all this, you still need to enable PostGIS in each database you will want to use it in. Refer to Enabling Extensions for more details. The extension enabling is also pretty generic for all OS, and is described in PostGIS Install http://postgis.net/install/

Installing ogrfdw binaries

ogr_fdw the spatial vector foreign data wrapper, is also available on yum. To install:

yum install ogr_fdw95
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.5ninesolutions.com
 * epel: mirror.us.leaseweb.net
 * extras: mirror.atlanticmetro.net
 * updates: centos.mirror.constant.com
Resolving Dependencies
--> Running transaction check
---> Package ogr_fdw95.x86_64 0:1.0.1-1.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch           Version                  Repository      Size
================================================================================
Installing:
 ogr_fdw95         x86_64         1.0.1-1.rhel7            pgdg95          23 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 23 k
Installed size: 54 k
Is this ok [y/d/N]:

Type y

If successful, you should see

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.5ninesolutions.com
 * epel: mirror.us.leaseweb.net
 * extras: mirror.atlanticmetro.net
 * updates: centos.mirror.constant.com
Resolving Dependencies
--> Running transaction check
---> Package ogr_fdw95.x86_64 0:1.0.1-1.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch           Version                  Repository      Size
================================================================================
Installing:
 ogr_fdw95         x86_64         1.0.1-1.rhel7            pgdg95          23 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 23 k
Installed size: 54 k
Is this ok [y/d/N]: y
Downloading packages:
ogr_fdw95-1.0.1-1.rhel7.x86_64.rpm                         |  23 kB   00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : ogr_fdw95-1.0.1-1.rhel7.x86_64                               1/1
  Verifying  : ogr_fdw95-1.0.1-1.rhel7.x86_64                               1/1

Installed:
  ogr_fdw95.x86_64 0:1.0.1-1.rhel7

Complete!

Installing pgRouting binaries

pgRouting is a PostgreSQL extension that extends PostGIS for building Location Based Services (LBS) specifically for trip navigation and resource dispatch. It is the subject of our upcoming book pgRouting: A practical guide due out later this year but will be ready for early purchase and Early Preview hopefully within the next week.

Note that since pgRouting relies on PostGIS for much of its functionality, you should have install PostGIS first before attempting to install pgRouting.

To install:

yum install pgrouting_95

You should see a screen like:

Dependencies Resolved

================================================================================
 Package              Arch           Version               Repository      Size
================================================================================
Installing:
 pgrouting_95         x86_64         2.1.0-1.rhel7         pgdg95         243 k

Transaction Summary
================================================================================
Install  1 Package

Total download size: 243 k
Installed size: 1.1 M
Is this ok [y/d/N]:

Type: y to the prompt.

You should see a screen like this

Downloading packages:
pgrouting_95-2.1.0-1.rhel7.x86_64.rpm                      | 243 kB   00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pgrouting_95-2.1.0-1.rhel7.x86_64                            1/1
  Verifying  : pgrouting_95-2.1.0-1.rhel7.x86_64                            1/1

Installed:
  pgrouting_95.x86_64 0:2.1.0-1.rhel7

Complete!

Now refer to the section Enabling Extensions for more details and also check out the pgRouting manual for pgRouting 2.1 at http://docs.pgrouting.org/2.1/doc/index.html.

Enabling Extensions in a database

To install PostGIS 2.2 and the extended family packaged with PostGIS 2.2 you'd create a database and install the extensions.

su postgres
/usr/pgsql-9.5/bin/psql -p 5432
CREATE DATABASE gistest;
\connect gistest;

Should give you message: You are now connected to database "gistest" as user "postgres".

Next install the extensions

CREATE EXTENSION postgis;
CREATE EXTENSION postgis_topology;
CREATE EXTENSION ogr_fdw;

To verify the install do:

SELECT postgis_full_version();

You should get something like:

                                                                            postgis_full_version
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 POSTGIS="2.2.1 r14555" GEOS="3.5.0-CAPI-1.9.0 r4084" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.11.2, released 2015/02/10" LIBXML="2.9.1" LIBJSON="0.11" TOPOLOGY RASTER

If the above output returns 2.2.0 instead of 2.2.1+, you should upgrade, by doing the following:

Exit out psql

\q
exit
and run yum with:

yum update postgis2_95

Which should give you:

Resolving Dependencies
--> Running transaction check
---> Package postgis2_95.x86_64 .. will be updated
---> Package postgis2_95.x86_64 .. will be an update
--> Finished Dependency Resolution
:

Now connect back as postgres and upgrade your database by doing the following

su postgres
/usr/pgsql-9.5/bin/psql -p 5432 -d gistest 

#once in psql console do the following
ALTER EXTENSION postgis UPDATE;
-- repeat for each extension so for example
-- if you installed postgis_topology
ALTER EXTENSION postgis_topology UPDATE;

-- then run to check version
SELECT postgis_full_version();

You should now see 2.2.1 listed

To install pgRouting and verify install

CREATE EXTENSION pgrouting;
SELECT * FROM pgr_version();

Should output

 version |       tag       | build |  hash   | branch | boost
---------+-----------------+-------+---------+--------+--------
 2.1.0   | pgrouting-2.1.0 | 1     | b38118a | master | 1.53.0
(1 row)