- Notifications
You must be signed in to change notification settings - Fork19
an opinionated environment for compiling R
License
rstudio/r-builds
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repository orchestrates tools to produce R binaries. The binaries are available as acommunity resource,they are not professionally supported by Posit.The R language is open source, please see the official documentation athttps://www.r-project.org/.
These binaries are not a replacement to existing binary distributions for R.The binaries were built with the following considerations:
- They use a minimal set ofbuild and runtime dependencies.
- They are designed to be used side-by-side, e.g., onPosit Workbench.
- They give users a consistent option for accessing R across different Linux distributions.
These binaries have been extensively tested, and are used in production everydayonPosit Cloud andshinyapps.io. Please open an issue to report a specificbug, or ask questions onPosit Community.
R binaries are built for the following Linux operating systems:
- Ubuntu 20.04, 22.04, 24.04
- Debian 12, 13
- CentOS 7
- Red Hat Enterprise Linux 7, 8, 9, 10
- openSUSE 15.6
- SUSE Linux Enterprise 15 SP6
- Fedora 41, 42
Operating systems are supported until their vendor end-of-support dates, whichcan be found on thePosit Platform Supportpage. When an operating system has reached its end of support, builds for itwill be discontinued, but existing binaries will continue to be available.
R binaries are primarily supported for the current R version and previous four minor versions of R.Older R versions down to R 3.0.0 are also built when possible, but support for older R versions is best effort and not guaranteed.
R versions 4.0.0 through 4.3.3 have been patched forCVE-2024-27322. See#218 for more details.
R binaries are built for x86_64/amd64 and aarch64/arm64.
To use our quick install script to install R, simply run the followingcommand. To use the quick installer, you must have root or sudo privileges,andcurl must be installed.
bash -c"$(curl -L https://rstd.io/r-install)"Define the version of R that you want to install. Available versionsof R can be found here:https://cdn.posit.co/r/versions.json
R_VERSION=4.4.3
Download the deb package:
# Ubuntu 20.04curl -O https://cdn.posit.co/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb# Ubuntu 22.04curl -O https://cdn.posit.co/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb# Ubuntu 24.04curl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb# Debian 12curl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb# Debian 13curl -O https://cdn.posit.co/r/debian-13/pkgs/r-${R_VERSION}_1_$(dpkg --print-architecture).deb
Then install the package:
sudo apt-get install ./r-${R_VERSION}_1_$(dpkg --print-architecture).deb
Enable theExtra Packages for Enterprise Linuxrepository (RHEL/CentOS 7 and RHEL 9 only):
# CentOS / RHEL 7sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm# Rocky Linux 9 / AlmaLinux 9sudo dnf install dnf-plugins-coresudo dnf config-manager --set-enabled crbsudo dnf install epel-release# RHEL 9sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
On RHEL 7, you may also need to 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) insteadsudo yum install yum-utilssudo yum-config-manager --enable"rhel-*-optional-rpms"
On RHEL 9, you may also need to enable the CodeReady Linux Builder repository:
sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms# If running RHEL 9 in a public cloud, such as Amazon EC2, enable the CodeReady# Linux Builder repository from Red Hat Update Infrastructure (RHUI) insteadsudo dnf install dnf-plugins-coresudo dnf config-manager --enable codeready-builder-for-rhel-9-*-rpms
Download the rpm package:
# CentOS / RHEL 7curl -O https://cdn.posit.co/r/centos-7/pkgs/R-${R_VERSION}-1-1.$(arch).rpm# RHEL 8 / Rocky Linux 8 / AlmaLinux 8curl -O https://cdn.posit.co/r/centos-8/pkgs/R-${R_VERSION}-1-1.$(arch).rpm# RHEL 9 / Rocky Linux 9 / AlmaLinux 9curl -O https://cdn.posit.co/r/rhel-9/pkgs/R-${R_VERSION}-1-1.$(arch).rpm# RHEL 10 / Rocky Linux 10 / AlmaLinux 10curl -O https://cdn.posit.co/r/rhel-10/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
Then install the package:
sudo yum install R-${R_VERSION}-1-1.$(arch).rpm
Download the rpm package:
# openSUSE 15.6 / SLES 15 SP6curl -O https://cdn.posit.co/r/opensuse-156/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
Then install the package:
sudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.$(arch).rpm
Download the rpm package:
# Fedora 41curl -O https://cdn.posit.co/r/fedora-41/pkgs/R-${R_VERSION}-1-1.$(arch).rpm# Fedora 42curl -O https://cdn.posit.co/r/fedora-42/pkgs/R-${R_VERSION}-1-1.$(arch).rpm
Then install the package:
sudo dnf install R-${R_VERSION}-1-1.$(arch).rpm
Test that R was successfully installed by running:
/opt/R/${R_VERSION}/bin/R --versionTo ensure that R is available on the system path, create symbolic links tothe version of R that you 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
You may want to install additional system dependencies for R packages.We recommend installing a TeX distribution (such asTinyTeXor TeX Live) and Pandoc. For more information on system dependencies, seesystem requirements for R packages.
If you want to install multiple versions of R on the same system, you canrepeat these steps to install a different version of R alongside existing versions.
This repository orchestrates builds using a variety of tools. Theinstructions below outline the components in the stack and describe how to add anew platform or inspect an existing platform.
To build the R binaries from source, you will need to haveGit,Docker, andmake installed.
First, clone the Git repository locally and navigate to it.
git clone https://github.com/rstudio/R-buildscd R-buildsThen, run thebuild-r-$PLATFORM Make target with theR_VERSION environment variableset to your desired R version, where$PLATFORM is one of the supported platformidentifiers, such asubuntu-2204 orrhel-9.
export PLATFORM=ubuntu-2204export R_VERSION=4.5.0make build-r-$PLATFORM
The built DEB or RPM package will be available in thebuilder/integration/tmp/$PLATFORMdirectory.
$ ls builder/integration/tmp/$PLATFORMr-4.5.0_1_amd64.debR is installed to/opt/R/${R_VERSION} by default. If you want to customize theinstallation path, set the optionalR_INSTALL_PATH environment variable to acustom location such as/opt/custom/R-4.5.0.
export PLATFORM=rhel-9export R_VERSION=4.5.0export R_INSTALL_PATH=/opt/custom/R-4.5.0make build-r-$PLATFORM
For significant changes to the R builds, such as adding a new platform or updating existing builds,include any relevant testing notes and changes that may affect existing users, such as system dependency changes.
On successful merge, a project maintainer can then trigger the builds in staging to test the changes, and then in productionwhen the changes have been verified.
- Builds should use OpenBLAS and align their BLAS/LAPACK configuration with the default distribution of R when possible,for maximum compatibility of binary R packages across R distributions. For example, Ubuntu/Debian should be configuredto use external BLAS, RHEL 9+ should use FlexiBLAS (to match EPEL), and SUSE should use shared BLAS. The BLAS/LAPACKlibrary should be swappable at runtime when possible.
- DEB/RPM packages should include the minimum set of dependencies when possible. Different R versions may have differentdependencies, so packaging scripts may conditionally add dependencies based on the R version.
- Add the new platform to the
Supported Platformslist. - Add DEB or RPM package download instructions for the new platform.
Create abuilder/Dockerfile.platform-version (whereplatform-version isubuntu-2204 orcentos-7, etc.) This file must contain four major tasks:
- an
OS_IDENTIFIERenv with theplatform-version. - a step which ensures the R source build dependencies are installed
COPYfor the packaging script (builder/package.platform-version) to/package.shCOPYandENTRYPOINTfor thebuild.shfile inbuilder/.
Create abuilder/package.platform-version script (whereplatform-version isubuntu-2204 orcentos-7, etc.).
A new service in the docker-compose file named according to theplatform-version and containing the proper entries:
ubuntu-2404:command:./build.shenvironment: -R_VERSION=${R_VERSION}# for testing out R builds locally -R_INSTALL_PATH=${R_INSTALL_PATH}# custom installation path -LOCAL_STORE=/tmp/output# ensures that output tarballs are persisted locallybuild:context:.dockerfile:Dockerfile.ubuntu-2404image:r-builds:ubuntu-2404volumes: -./integration/tmp:/tmp/output# path to output tarballsplatform:${PLATFORM_ARCH}# for testing other architectures via emulation
Add the new platform to thePLATFORMS variable near the top of the Makefile.
A new service in thetest/docker-compose.yml file named according to theplatform-version and containing the proper entries:
ubuntu-2204:image:ubuntu:jammycommand:/r-builds/test/test-apt.shenvironment: -OS_IDENTIFIER=ubuntu-2204 -R_VERSION=${R_VERSION}volumes: -../:/r-buildsplatform:${PLATFORM_ARCH}
Update the quick install script atinstall.sh, if necessary, to support the new platform.
Once you've followed the steps above, submit a pull request.
In addition to the DEB and RPM packages, R builds also publishes tarballs of the binaries at:
- x86_64:
https://cdn.posit.co/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}.tar.gz - arm64:
https://cdn.posit.co/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}-arm64.tar.gz
These may be used with a manual installation of R's system dependencies. System dependencies will differ between R versions,so inspect the corresponding DEB or RPM package for the list of system dependencies.
TheCheck for new R versions workflowchecks for new R versions hourly and automatically builds and publishes them.
TheDaily R-devel and R-next builds workflowbuilds and publishes R-devel and R-next each day.
TheR builds workflowtests building the R binaries and optionally publishes them. Builds are not automatically published upon merging tomain.
After making any changes to R-builds, this workflow may be run manually to test the changes instaging first. Then,the workflow can be rerun forproduction to build new binaries or rebuild existing binaries.
Tests are automatically run on each push.These tests validate that R was correctly configured, built, and packaged. By default, the tests runfor the last 5 minor R versions on each platform.
To run the tests manually, you can navigate to theGitHub Actions workflow pageand use "Run workflow" to run the tests from a custom branch, list of platforms, and list of R versions.
To skip the tests, add[skip ci] to your commit message. SeeSkipping workflow runsfor more information.
To test the R builds locally, you can use thebuild-r-$PLATFORM andtest-r-$PLATFORMtargets to build R and run the tests. The tests use the quick install script to install R,using a locally built R if present, or otherwise a build from the CDN.
# Build R 4.5.0 for Ubuntu 22R_VERSION=4.5.0 make build-r-ubuntu-2204# Test R 4.5.0 for Ubuntu 22R_VERSION=4.5.0 make test-r-ubuntu-2204
Alternatively, you can build an image using thedocker-build-$PLATFORMtarget, launch a bash session within a container using thebash-$PLATFORM target,and interactively run the build script:
# Build the image for Ubuntu 22make docker-build-ubuntu-2204# Launch a bash session for Ubuntu 22make bash-ubuntu-2204# Build R 4.5.0R_VERSION=4.5.0 ./build.sh# Build R devel with parallel execution to speed up the buildMAKEFLAGS=-j4 R_VERSION=devel ./build.sh# Build a prerelease version of R (e.g., alpha or beta)R_VERSION=rc R_TARBALL_URL=https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz ./build.sh
Builds default to the current host architecture by default. If you would like to test a differentarchitecture via emulation in Docker, setPLATFORM_ARCH to a valid Docker--platform flag:
# Build R 4.5.0 for Ubuntu 22, ARM64R_VERSION=4.5.0 PLATFORM_ARCH=linux/arm64 make build-r-ubuntu-2204# Test R 4.5.0 for Ubuntu 22, ARM64R_VERSION=4.5.0 PLATFORM_ARCH=linux/arm64 make test-r-ubuntu-2204
About
an opinionated environment for compiling R
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.