【问题标题】:How can I install the newest version of R (currently 4.0.0) on CentOS?如何在 CentOS 上安装最新版本的 R(目前为 4.0.0)?
【发布时间】:2020-08-31 05:55:33
【问题描述】:

标题几乎说明了这一点。我已经安装了 epel,当我尝试 yum 新版本时,我得到了 3.6.0 版本。

我知道可以从源代码编译它,但 CRAN 似乎想让我远离它(我很乐意接受)。

【问题讨论】:

    标签: r centos epel


    【解决方案1】:

    RStudio 文档有一个关于如何在 CentOS 7 和 8 上安装几乎所有 R 版本(包括 4.X.X)的详细教程:https://docs.rstudio.com/resources/install-r/#optional-install-recommended-packages

    如果链接被删除,我在这里详细说明 CentOS 7 的步骤:

    # Enable the Extra Packages for Enterprise Linux (EPEL) repository
    sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
    
    # On RHEL 7, enable the Optional repository
    sudo subscription-manager repos --enable "rhel-*-optional-rpms"
    
    # If running RHEL 7 in a public cloud, such as Amazon EC2, enable the
    # Optional repository from Red Hat Update Infrastructure (RHUI) instead
    sudo yum install yum-utils
    sudo yum-config-manager --enable "rhel-*-optional-rpms"
    
    # Download and install R
    export R_VERSION=4.0.0
    curl -O https://cdn.rstudio.com/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
    sudo yum install R-${R_VERSION}-1-1.x86_64.rpm
    
    # Verify installation
    /opt/R/${R_VERSION}/bin/R --version
    
    # Create symlink to R
    sudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R
    sudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript
    

    【讨论】:

      【解决方案2】:

      默认通道不存储最新版本的R。幸运的是,您可以通过conda-forge通道获取最新版本的R。因此,您应该先添加此频道。

      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda
      conda config --set show_channel_urls yes
      conda search R
      conda install R
      

      【讨论】:

      • 虽然此代码可能会解决问题,including an explanation 关于如何以及为什么解决问题将真正有助于提高您的帖子质量,并可能导致更多的赞成票。请记住,您正在为将来的读者回答问题,而不仅仅是现在提问的人。请edit您的回答添加解释并说明适用的限制和假设。
      【解决方案3】:

      我能够使用此页面上的脚本获得 R 版本 4.0.2:

      https://www.osradar.com/how-to-install-r-and-rstudio-on-centos-8/

      唯一的问题是修复路径的说明对我不起作用,所以我只是在 RStudio Server 中更改了它。

      【讨论】:

        猜你喜欢
        • 2015-05-11
        • 2016-10-12
        • 1970-01-01
        • 2020-09-15
        • 2015-11-12
        • 2020-05-20
        • 2016-01-11
        • 1970-01-01
        • 2021-05-12
        相关资源
        最近更新 更多