Install R
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.
R is not Posit Software and is included in Third Party Materials (as defined in our EULA) and not covered under the Posit Support Agreement. If you download R, you are agreeing to their license and acknowledge Posit is not responsible for R and you are downloading R at your sole risk.
Supported architectures
R is available for both the x86_64/amd64 and aarch64/arm64 architectures.
R requirements for Posit Team products
Each product’s R version requirements are documented in its respective product documentation:
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:
No additional repositories or dependencies are required for RHEL 10.
Enable the Extra Packages for Enterprise Linux (EPEL) repository:
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpmEnable the CodeReady Linux Builder repository:
sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms# enable the CodeReady Linux Builder repository from Red Hat Update Infrastructure (RHUI)
sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled codeready-builder-for-rhel-9-*-rpmsEnable the Extra Packages for Enterprise Linux (EPEL) repository
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpmEnable the CodeReady Linux Builder repository:
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms# enable the CodeReady Linux Builder repository from Red Hat Update Infrastructure (RHUI)
sudo dnf install dnf-plugins-core
sudo dnf config-manager --set-enabled "codeready-builder-for-rhel-8-*-rpms"Specify R version
Consult with your R user group to determine which version(s) of R they would like installed and then confirm that the version(s) of R are supported by the Posit product.
Once defined, set the environment variable, shown below, to the first R version they request.
All available versions of R may not be supported by each product. Please verify the supported R versions in the product guides and release notes.
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.6.0Versions of R that are available include: 3.6.x, 4.0.x, 4.1.x, 4.2.x, 4.3.x, 4.4.x, 4.5.x, 4.6.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.XPlease 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.posit.co/r/rhel-10/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
sudo dnf install R-${R_VERSION}-1-1.$(arch).rpmcurl -O https://cdn.posit.co/r/rhel-9/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
sudo dnf install R-${R_VERSION}-1-1.$(arch).rpmcurl -O https://cdn.posit.co/r/centos-8/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
sudo dnf install R-${R_VERSION}-1-1.$(arch).rpmcurl -O https://cdn.posit.co/r/ubuntu-2604/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).debcurl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).debcurl -O https://cdn.posit.co/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).debcurl -O https://cdn.posit.co/r/debian-13/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).debcurl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
sudo apt-get update
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).debcurl -O https://cdn.posit.co/r/opensuse-156/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
sudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.$(arch).rpmVerify R installation
Test that R was successfully installed by running:
/opt/R/${R_VERSION}/bin/R --versionCreate a symlink to R
This section only applies to the first installation of R on a given system.
Skip this section for subsequent installation.
To ensure that R is available on the default system PATH variable, create symbolic links to the version of R that is installed:
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(Optional) Install system dependencies of common R packages
Many R packages require system packages to be installed. An R package will fail to compile and install if its system dependencies are not available. Posit recommends installing these system requirements before your data science team begins deploying content.
Posit Package Manager can serve portable Linux binaries that bundle their system dependencies, letting your users install R packages without separately installing system libraries. Portable binaries are a recommended alternative to the manual installation below.
These packages are third-party packages and subject to any license terms that accompany them. These packages are not Posit Software and are Third Party Materials (as defined in our EULA). If you download these packages, you are agreeing to the applicable license terms that accompany such packages and acknowledge Posit is not responsible for these packages. You are downloading these packages at your sole risk.
Posit Package Manager can automatically detect known system dependencies and provides installation commands for supported Linux operating systems. The System Dependency Detection documentation provides additional information.
The commands below install the system dependencies required by a curated set of common R packages on each supported Linux distribution. Depending on your user permissions, you might need to use sudo.
subscription-manager repos --enable codeready-builder-for-rhel-10-$(arch)-rpms
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
dnf install -y ImageMagick-c++-devel ImageMagick-devel abseil-cpp-devel cairo-devel cmake fontconfig-devel freetype-devel fribidi-devel gdal gdal-devel geos-devel git harfbuzz-devel java-21-openjdk-devel libX11-devel libcurl-devel libgit2-devel libicu-devel libjpeg-turbo-devel libpng-devel libsodium-devel libssh2-devel libtiff-devel libuv-devel libwebp-devel libxml2-devel make mariadb-devel mesa-libGL-devel mesa-libGLU-devel nodejs-libs openssl-devel poppler-cpp-devel poppler-data proj-devel protobuf-compiler protobuf-devel python3 sqlite-devel tcl texlive tk tk-devel udunits2-devel unixODBC-devel zlib-ng-compat-develsubscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf install -y ImageMagick-c++-devel ImageMagick-devel abseil-cpp-devel cairo-devel cmake fontconfig-devel freetype-devel fribidi-devel gdal gdal-devel geos-devel git glpk-devel harfbuzz-devel java-11-openjdk-devel libX11-devel libcurl-devel libgit2-devel libicu-devel libjpeg-turbo-devel libpng-devel libsodium-devel libssh2-devel libtiff-devel libuv-devel libwebp-devel libxml2-devel make mariadb-devel mesa-libGL-devel mesa-libGLU-devel nodejs-libs openssl-devel poppler-cpp-devel poppler-data proj-devel protobuf-compiler protobuf-devel python3 sqlite-devel tcl texlive tk tk-devel udunits2-devel unixODBC-devel zlib-develsubscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf install -y ImageMagick-c++-devel ImageMagick-devel abseil-cpp-devel cairo-devel cmake fontconfig-devel freetype-devel fribidi-devel gdal gdal-devel geos-devel git glpk-devel harfbuzz-devel java-1.8.0-openjdk-devel libX11-devel libcurl-devel libgit2_1.7-devel libicu-devel libjpeg-turbo-devel libpng-devel libsodium-devel libssh2 libtiff-devel libuv-devel libwebp-devel libxml2-devel make mariadb-devel mesa-libGL-devel mesa-libGLU-devel openssl-devel poppler-cpp-devel poppler-data proj-devel protobuf-devel sqlite-devel tcl texlive tk tk-devel udunits2-devel unixODBC-devel zlib-develapt install -y cmake default-jdk gdal-bin git gsfonts libabsl-dev libcairo2-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgdal-dev libgeos-dev libgl1-mesa-dev libglpk-dev libglu1-mesa-dev libharfbuzz-dev libicu-dev libjpeg-dev libmagick++-dev libmysqlclient-dev libnode-dev libpng-dev libpoppler-cpp-dev libproj-dev libprotobuf-dev libprotoc-dev libsodium-dev libsqlite3-dev libssh2-1-dev libssl-dev libtiff-dev libudunits2-dev libuv1-dev libwebp-dev libx11-dev libxml2-dev make poppler-data protobuf-compiler python3 tcl texlive tk tk-dev tk-table unixodbc-dev zlib1g-devapt install -y cmake default-jdk gdal-bin git gsfonts libabsl-dev libcairo2-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgdal-dev libgeos-dev libgl1-mesa-dev libglpk-dev libglu1-mesa-dev libharfbuzz-dev libicu-dev libjpeg-dev libmagick++-dev libmysqlclient-dev libnode-dev libpng-dev libpoppler-cpp-dev libproj-dev libprotobuf-dev libprotoc-dev libsodium-dev libsqlite3-dev libssh2-1-dev libssl-dev libtiff-dev libudunits2-dev libuv1-dev libwebp-dev libx11-dev libxml2-dev make poppler-data protobuf-compiler python3 tcl texlive tk tk-dev tk-table unixodbc-dev zlib1g-devzypper install -y ImageMagick-devel Mesa-libGL-devel cairo-devel cmake fontconfig-devel freetype2-devel git glu-devel libMagick++-devel libX11-devel libcurl-devel libjpeg8-devel libopenssl-devel libpng16-compat-devel libpoppler-devel libssh2-devel libtiff-devel libuv-devel libwebp-devel libxml2-devel make poppler-data protobuf-devel sqlite3-devel tcl texlive tk tk-devel unixODBC-devel zlib-develapt install -y cmake default-jdk gdal-bin git gsfonts libabsl-dev libcairo2-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgdal-dev libgeos-dev libgl1-mesa-dev libglpk-dev libglu1-mesa-dev libharfbuzz-dev libicu-dev libjpeg-dev libmagick++-dev libmariadb-dev libmariadb-dev-compat libnode-dev libpng-dev libpoppler-cpp-dev libproj-dev libprotobuf-dev libprotoc-dev libsodium-dev libsqlite3-dev libssh2-1-dev libssl-dev libtiff-dev libudunits2-dev libuv1-dev libwebp-dev libx11-dev libxml2-dev make poppler-data protobuf-compiler python3 tcl texlive tk tk-dev tk-table unixodbc-dev zlib1g-devapt install -y cmake default-jdk gdal-bin git gsfonts libabsl-dev libcairo2-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgdal-dev libgeos-dev libgl1-mesa-dev libglpk-dev libglu1-mesa-dev libharfbuzz-dev libicu-dev libjpeg-dev libmagick++-dev libmariadb-dev libmariadb-dev-compat libnode-dev libpng-dev libpoppler-cpp-dev libproj-dev libprotobuf-dev libprotoc-dev libsodium-dev libsqlite3-dev libssh2-1-dev libssl-dev libtiff-dev libudunits2-dev libuv1-dev libwebp-dev libx11-dev libxml2-dev make poppler-data protobuf-compiler python3 tcl texlive tk tk-dev tk-table unixodbc-dev zlib1g-devThese installation commands are also available from Posit Public Package Manager. If you are using a self-managed Posit Package Manager instance, the same installation commands are available on the setup page for your repository and on the details page for each package.
(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.
Uninstall
sudo rm -rf /opt/R/${R_VERSION}/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.