I'm trying to install multiple versions of PostGis and PgRouting in the same instance of PostgreSQL v9.6, using CentOS 7.5.

I've been fighting with dependencies and shared libraries, to make all working.

So the question is, which is the best way to manage de dependencies versions? If I install a major dependency version, old Postgis version still working?

Some dependencies are: GDAL, GEOS, Proj4, etc.

I've been organizing them in folders, with contains subfolders with the version of the dependency, using --prefix=path/v3.0.0 on ./configure script during the depency installation.

Example: Folder -> GEOS - Subfolders: v3.0.0, v3.4.0, etc.

After that, when i want to install any PostGIS version, I use ./configure to use any dependency absolute path.

Example: ./configure --with-pgconfig=path --with-gdal=path/version --with-proj4=path/version ...

But I'm not sure that is a right way.

Any suggestion is welcome to clear my mind.


It won't work to install several versions of PostGIS in the same PostgreSQL software directory, since the resulting shared objects will have the same name. Using a different --prefix is not enough, since most of PostGIS is not installed there, but in the PostgreSQL software directory.

So you should make a copy of your PostgreSQL software directory and install the different PostGIS versions in different directories.

If you really need different versions of Proj, GDAL etc. (why?), things become difficult, and you'd have to use a different LD_LIBRARY_PATH for each instance.

But perhaps it is much simpler, since the recent versions of PostGIS are binary compatible and come with installation scripts for several versions.

So maybe you can do with just installing the most recent PostGIS version and using different versions in different databases:

  • Hi Laurenz, thanks for your reply. For example, if I need to install PostGIS 2.0, it needs GDAL 2.0, but if i need to install another PostGIS 2.4 in the same CentOS 7, i need to install GDAL 3.4. This is why I separate the installations in different folders. This is not necessary? If I install GDAL 3.4, PostGIS 2.0 is still working? Sorry for my bad english, I'm trying my best. Aug 13 '19 at 16:59
  • I have extended the answer: using different --prefix isn't enough, because PostGIS is not installed there, but in the PostgreSQL software directory. As to the requirements: PostGIS 2.0 requires GDAL 1.6 or higher, PostGIS 2.4 requires GDAL 1.8 or higher. So I don't see your problem if you build PostGIS yourself. Aug 14 '19 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.