如何在CentOS 6.8上安装SF R的软件包或GDAL

时间:2018-12-03 16:09:56

标签: r centos gdal sf

我正在尝试通过以下命令通过行命令在服务器CentOS 6.8的R上安装sf软件包:

install.packages('sf', dependencies = TRUE)

我收到此错误消息:

> install.packages('sf')
Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/sf_0.7-1.tar.gz'
Content type 'application/x-gzip' length 8330564 bytes (7.9 MB)
==================================================
downloaded 7.9 MB

* installing *source* package ‘sf’ ...
** package ‘sf’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64 -std=gnu++0x
checking for gdal-config... /usr/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 1.7.3
checking GDAL version >= 2.0.0... no
configure: error: sf is not compatible with GDAL versions below 2.0.0
ERROR: configuration failed for package ‘sf’
* removing ‘/usr/lib64/R/library/sf’

The downloaded source packages are in
        ‘/tmp/RtmpKDXg4S/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
Warning message:
In install.packages("sf") :
  installation of package ‘sf’ had non-zero exit status

看起来我需要将GDAL升级到2.0.0或更高版本,但是我不知道该怎么做。我正在CentOS上通过命令行安装(甚至升级),却一无所获。

任何帮助将不胜枚举。

Tks

1 个答案:

答案 0 :(得分:0)

对于那些希望找到在RHEL 7.5上安装“ sf”的说明的人,

wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/u/udunits2-2.2.20-2.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/u/udunits2-devel-2.2.20-2.el7.x86_64.rpm
yum install udunits2-devel-2.2.20-2.el7.x86_64.rpm
yum install udunits2-2.2.20-2.el7.x86_64.rpm

wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/g/geos-3.4.2-2.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/g/geos-devel-3.4.2-2.el7.x86_64.rpm
yum install geos-*

wget http://download.osgeo.org/gdal/2.4.1/gdal-2.4.1.tar.gz
tar -zxvf gdal-2.4.1.tar.gz
cd gdal-2.4.1; 
./configure; make -j4; make install
echo "/usr/local/lib" /etc/ld.so.conf.d/libgdal-x86_64.conf
ldconfig
cp -p /usr/local/lib/libgdal.so.20* /usr/lib64/

cd ../
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/proj-4.8.0-4.el7.x86_64.rpm
wget http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/p/proj-devel-4.8.0-4.el7.x86_64.rpm
yum install proj-4.8.0-4.el7.x86_64.rpm proj-devel-4.8.0-4.el7.x86_64.rpm

有些行可能是多余的,但这对我有用。