You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

本地RedHat 6系统下安装R语言rgdal包的依赖配置求助

Installing rgdal on Red Hat 6 (Offline, Limited Repo Access)

Got it, let's tackle this rgdal installation issue head-on. Since you're on a local Red Hat 6 server with no internet and limited repo access, we'll need to build all dependencies from source—starting with PROJ.4 and GDAL, then moving to rgdal itself. Here's the step-by-step process:

1. Install Required Compilation Tools First

Red Hat 6 needs basic build tools to compile source code. If these aren't already installed, you'll need to grab their RPMs from a trusted source (e.g., a connected machine with Red Hat 6 media) and transfer them to your server:

  • Check for gcc: gcc --version
    • If missing: Install with rpm -ivh gcc-4.4.7-23.el6.x86_64.rpm (adjust version to match your system)
  • Check for make: make --version
    • If missing: Install with rpm -ivh make-3.81-23.el6.x86_64.rpm
  • Install gcc-c++ (required for some GDAL components): rpm -ivh gcc-c++-4.4.7-23.el6.x86_64.rpm

2. Build and Install PROJ.4 from Source

rgdal requires PROJ.4 (or newer PROJ versions) as a core dependency. We'll install it to a custom path to avoid conflicts with system packages:

  • Download a compatible PROJ version (e.g., 6.2.1, which works with Red Hat 6 and later rgdal versions) from a connected machine, then transfer the proj-6.2.1.tar.gz file to your server.
  • Extract the source:
    tar -xvf proj-6.2.1.tar.gz
    cd proj-6.2.1
    
  • Configure the build (specify an install path like /usr/local/proj):
    ./configure --prefix=/usr/local/proj
    
  • Compile and install:
    make && make install
    
  • Update your environment variables so the system can find PROJ:
    echo 'export LD_LIBRARY_PATH=/usr/local/proj/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
    echo 'export PATH=/usr/local/proj/bin:$PATH' >> ~/.bashrc
    source ~/.bashrc
    

3. Build and Install GDAL from Source

Next, install GDAL, which relies on the PROJ we just set up:

  • Download a compatible GDAL version (e.g., 3.0.4, which pairs well with PROJ 6.2.1) as a tar.gz file, transfer it to your server.
  • Extract the source:
    tar -xvf gdal-3.0.4.tar.gz
    cd gdal-3.0.4
    
  • Configure the build, pointing it to our custom PROJ installation:
    ./configure --prefix=/usr/local/gdal --with-proj=/usr/local/proj
    
  • Compile and install:
    make && make install
    
  • Update environment variables for GDAL:
    echo 'export LD_LIBRARY_PATH=/usr/local/gdal/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
    echo 'export PATH=/usr/local/gdal/bin:$PATH' >> ~/.bashrc
    source ~/.bashrc
    

4. Install rgdal from Source in R

Finally, we can install the rgdal R package using the dependencies we built:

  • Download the rgdal source package (e.g., rgdal_1.5-28.tar.gz) from CRAN on a connected machine, transfer it to your server.
  • Launch R:
    R
    
  • Run the installation command, specifying the paths to GDAL and PROJ:
    install.packages("rgdal_1.5-28.tar.gz", type = "source",
                     configure.args = c("--with-gdal=/usr/local/gdal",
                                       "--with-proj=/usr/local/proj",
                                       "--with-proj-lib=/usr/local/proj/lib",
                                       "--with-proj-include=/usr/local/proj/include"))
    
  • Verify the installation works:
    library(rgdal)
    
    If no errors pop up, you're good to go!

内容的提问来源于stack exchange,提问作者Carole

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 07:03:35