Installing the sf package in RedHat Linux

Por Emilio L. Cano | 2019-04-22

We have some Shiny Applications in our http://shiny.uclm.es Shiny server that plot interactive maps. They use the sf package to read shape files, but when installing the package in the RedHat Linux server we found several dependency problems. This is the path we follow to get it working.

The R package needs the rgdal Linux package (>2.0.0), but in the repositories the available version is older. Then we had to install from source.

wget http://download.osgeo.org/gdal/2.4.1/gdal-2.4.1.tar.gz
tar xvzf gdal-2.4.1.tar.gz 
cd gdal-2.4.1
./configure
make
make install

Still, the package installation did not find the programs. Not sure if this was necessary or not:

cd /etc/ld.so.conf.d/
touch libgdal-x86_64.conf
vi libgdal-x86_64.conf # /usr/local/lib
ldconfig

Errors keep showing, not found PROJ. Then we did the following and after the last step it worked:

yum install proj proj-devel
yum install proj-epsg proj-nad
yum install https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm
yum install geos-devel

This was after a lot of Internet searchers, most of the tips were fond in StackOverflow.