Skip to content

Instantly share code, notes, and snippets.

@glin glin/
Last active Feb 13, 2020

What would you like to do?
Install sf from source on CentOS/RHEL 7
# Install sf from source on CentOS/RHEL 7. Tested with sf 0.8.0 on R 3.4 and 3.6.
yum update -y
# Pre-reqs: gcc, gcc-c++, make
yum install -y gcc gcc-c++ make
# Install EPEL 7
yum install -y
# Install sf pre-reqs (note that proj-epsg is also required)
yum install -y geos-devel proj-devel proj-epsg udunits2-devel
# Install GDAL 2.x from source (replace VERSION with any other release from
curl -O${VERSION}/gdal-${VERSION}.tar.gz
tar -xzvf gdal-${VERSION}.tar.gz
cd gdal-${VERSION}
./configure --prefix=/usr # install to /usr/lib. if --prefix isn't set, installs to /usr/local/lib by default
make install
# Install sf
R -e 'install.packages("sf", repos = "")'
# Test that the sf install worked
R -e 'library(sf)'
## > library(sf)
## Linking to GEOS 3.4.2, GDAL 2.3.2, PROJ 4.8.0
# Cleanup
cd ..
rm -rf gdal-${VERSION} gdal-${VERSION}.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.