[GIS] Installing pgrouting on Ubuntu 16.04 fails

pgroutingpostgispostgresqlUbuntu

I tried to install pgrouting on Ubuntu 16.04 but I got following error message:

CREATE EXTENSION pgrouting;

could not open extension control file "/opt/PostgreSQL/9.6/share/postgresql/extension/pgrouting.control": file or directory not found

I downloaded the EnterprisDB Postgres(9.6) Bundle, installed postgres ant then installed PostGis using the stackbuilder.
I was able to create the PostGis extension and the topology extension.
Some other extensions like pgrouting fail to install.

Does anyone know why intallation of some extensions fail?

I did the same on Win10 a few days ago an everything worked.

Best Answer

Because pgRouting can be installed as Ubuntu package from the PostgreSQL Apt repository, the easiest way is to add this repository and then run

sudo apt-get install postgresql-9.6-pgrouting

How to add the PostgreSQL Apt repository is described here: https://www.postgresql.org/download/linux/ubuntu/

I don't know what "stackbuilder" means for Ubuntu, because I only try installation via package manager, but in case you have installed another version of PostgreSQL, too, make sure that:

  • you are using the PostgreSSQL 9.6 (and not the other version)
  • you have installed pgRouting for PostgreSQL 9.6