How to Manually Install R 4.1.2 on CentOS 7

CentOS 7 is an old distro which does not have the new developer tools. In order to install the latest R 4.1.2, I need to install a newer devtoolset.

  1. Download the scl repo rpms
    wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-rh-2-3.el7.centos.noarch.rpm
    wget http://mirror.centos.org/centos/7/extras/x86_64/Packages/centos-release-scl-2-3.el7.centos.noarch.rpm
  2. Install the rpms.
    sudo rpm -ivh centos-release-scl-rh-2-3.el7.centos.noarch.rpm
    sudo rpm -ivh centos-release-scl-2-3.el7.centos.noarch.rpm
  3. Install scl.
    sudo yum install centos-release-scl
  4. Install devtoolset 7.
    sudo yum install devtoolset-7
  5. Enable devtoolset 7.
    sudo scl enable devtoolset-7 bash
  6. Download R 4.1.2.
    wget https://cran.r-project.org/src/base/R-4/R-4.1.2.tar.gz
  7. Extract R 4.1.2.
    tar xvf R-4.1.2.tar.gz
  8. Change directory to it.
    cd R-4.1.2/
  9. Configure the make environment. The arguments are optional.
    ./configure --prefix=/share/apps/R-4.1.2 --enable-R-shlib
  10. Make and install it. This takes a while.
    make
    make install


This post may contain affiliated links. When you click on the link and purchase a product, we receive a small commision to keep us running. Thanks.