I'm trying to install GDAL 2.x on my CentOS 7.4 server.

I looked at what is available, and it is still at v 1.11 of GDAL

Since I need GDAL v 2.x along with libKML support, looks like I'll have to build it from source.

I looked at the documentation for building from source, and I found the details unclear.

  • What options to give when configuring the make file?
  • How do I specify that I need the libKMl & PostGreSQL Drivers?

Is there a Page/documentation which shows how GDAL 2.x can be compiled from source on a CentOS 7.4 server?


I found this answer which pointed me in the correct direction: https://gis.stackexchange.com/a/120103/442

I just had to update the GDAL version there.

These are the commands that I used to get a successful deployment of GDAL v2.x

#Install the tools that we will use
yum groupinstall "Development Tools"
yum install wget

#for Postgresql support
sudo yum install postgresql postgresql-devel

#libkml Support
##---------This part is depending on prebuilt libraries. In the future we may replace this by compiling them from source.
wget http://s3.amazonaws.com/etc-data.koordinates.com/gdal-travisci/install-libkml-r864-64bit.tar.gz
tar xzf install-libkml-r864-64bit.tar.gz

#Copy these required files to  /usr/local
sudo cp -r install-libkml/include/* /usr/local/include
sudo cp -r install-libkml/lib/* /usr/local/lib
sudo ldconfig

#download GDAL
wget http://download.osgeo.org/gdal/2.2.3/gdal-2.2.3.tar.gz

tar xzf gdal-2.2.3.tar.gz
cd gdal-2.2.3

#Compile from source
./configure --with-libkml 
make install
  • Hey can you tell us a way we can do it on heroku. – Sandeep Kumar Jan 9 '18 at 9:11
  • @SandeepKumar: I don't know any thing about heroku, but this would be a great question for you to ask here. – Devdatta Tengshe Jan 12 '18 at 6:53
  • Does this install for all users? – Brian D Jun 12 at 18:43

I encountered the same error concerning SFCGAL library and I solve it installing the corresponding devel library

e.g. on Centos 7.4

sudo yum install SFCGAL-devel

I hope it can be useful also for you


Following your instructions I get the following error after executing the make command:

In file included from ogrgeometryfactory.cpp:40:0: ogr_sfcgal.h:34:34: fatal error: SFCGAL/capi/sfcgal_c.h: No such file or directory #include ^ compilation terminated. make[1]: * [ogrgeometryfactory.lo] Error 1 make[1]: Leaving directory `/home/admin/Downloads/gdal-2.2.3/ogr' make: * [ogr-target] Error 2

I'm using centOS 7.4, current gdal version 1.11.4:

May you have any hint?

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.