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:

Enable the Extra Packages for Enterprise Linux (EPEL) repository

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

Enable the Optional 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.3.3

Versions of R that are available include:

4.4.0, 4.3.3, 4.3.2, 4.3.1, 4.3.0, 4.2.3, 4.2.2, 4.2.1, 4.2.0, 4.1.3, 4.1.2, 4.1.1, 4.1.0, 4.0.5, 4.0.4, 4.0.3, 4.0.2, 4.0.1, 4.0.0


3.6.3, 3.6.2, 3.6.1, 3.6.0, 3.5.3, 3.5.2, 3.5.1, 3.5.0, 3.4.4, 3.4.3, 3.4.2, 3.4.1, 3.4.0, 3.3.3, 3.3.2, 3.3.1, 3.3.0

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

export R_VERSION=3.X.X

Please see the cran.r-project index 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