Install R

These instructions describe how to install R from precompiled binaries on a Linux server.


The recommended installation instructions for R covers making multiple versions of R available, and avoid replacing existing versions of R when updating system packages.

Additionally, these instructions cover installing multiple versions of R, downloading R, creating a symlink to R, etc.

Install required dependencies

To install the necessary runtime dependencies for R, enable additional repositories for third-party or source packages by using the following commands:

Enable the Extra Packages for Enterprise Linux (EPEL) repository:

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

Enable the CodeReady Linux Builder repository:

Enable the Extra Packages for Enterprise Linux (EPEL) repository

sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Enable the CodeReady Linux Builder repository:

sudo apt-get update
sudo apt-get install gdebi-core

Specify R version

Consult with your R user group to determine which version/versions of R they would like installed. Once defined, set the environment variable, shown below, to the first R version they request.

Note

The CVE-2024-27322 patched versions of R >= 4.0.0 are available via the links below. If you previously installed R from these links, reinstall to obtain a patched version. See rstudio/r-builds#219 for more details.

For multiple versions of R, follow the remaining steps and repeat them for each R version required:

export R_VERSION=4.4.1

Versions of R that are available include: 3.6.x, 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x

If you need to use an earlier version of R, then you will need to modify the export command shown above:

Terminal
export R_VERSION=3.X.X

Please see the CRAN index of R versions for all available versions of R.

Download and install R

Download and install the desired version of R.

curl -O https://cdn.rstudio.com/r/opensuse-155/pkgs/R-${R_VERSION}-1-1.x86_64.rpm
sudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.x86_64.rpm

Verify R installation

Test that R was successfully installed by running:

/opt/R/${R_VERSION}/bin/R --version

(Optional) Install multiple versions of R

To install multiple versions of R on the same server, repeat these steps to specify, download, and install a different version of R alongside existing versions.

Additional information

Refer to the rstudio/r-builds repository on GitHub for more information on these binary distributions of R.

If you need to customize how R is configured. For example, installing R at a different location than /opt/R, then follow these steps to install R from source.

Back to top