{"id":19490395,"url":"https://github.com/rstudio/r-builds","last_synced_at":"2025-04-25T19:31:50.272Z","repository":{"id":38818913,"uuid":"177628565","full_name":"rstudio/r-builds","owner":"rstudio","description":"an opinionated environment for compiling R","archived":false,"fork":false,"pushed_at":"2025-04-18T01:34:53.000Z","size":916,"stargazers_count":109,"open_issues_count":26,"forks_count":19,"subscribers_count":37,"default_branch":"main","last_synced_at":"2025-04-18T14:54:06.639Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rstudio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-03-25T16:56:28.000Z","updated_at":"2025-04-09T19:56:02.000Z","dependencies_parsed_at":"2024-02-29T21:28:28.487Z","dependency_job_id":"c6a32dd9-477e-46dc-aafd-0cc3b7028020","html_url":"https://github.com/rstudio/r-builds","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-builds","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-builds/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-builds/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rstudio%2Fr-builds/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rstudio","download_url":"https://codeload.github.com/rstudio/r-builds/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250882637,"owners_count":21502341,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T21:12:47.980Z","updated_at":"2025-04-25T19:31:50.264Z","avatar_url":"https://github.com/rstudio.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# r-builds\n\nThis repository orchestrates tools to produce R binaries. The binaries are available as a\ncommunity resource, **they are not professionally supported by Posit**. \nThe R language is open source, please see the official documentation at https://www.r-project.org/.\n\nThese binaries are not a replacement to existing binary distributions for R.\nThe binaries were built with the following considerations:\n- They use a minimal set of [build and runtime dependencies](builder).\n- They are designed to be used side-by-side, e.g., on [Posit Workbench](https://docs.posit.co/ide/server-pro/r/using_multiple_versions_of_r.html).\n- They give users a consistent option for accessing R across different Linux distributions.\n\nThese binaries have been extensively tested, and are used in production everyday\non [Posit Cloud](https://posit.cloud) and\n[shinyapps.io](https://shinyapps.io). Please open an issue to report a specific\nbug, or ask questions on [Posit Community](https://forum.posit.co/).\n\n## Supported Platforms\n\nR binaries are built for the following Linux operating systems:\n\n- Ubuntu 20.04, 22.04, 24.04\n- Debian 12\n- CentOS 7\n- Red Hat Enterprise Linux 7, 8, 9\n- openSUSE 15.6\n- SUSE Linux Enterprise 15 SP6\n- Fedora 40, 41\n\nOperating systems are supported until their vendor end-of-support dates, which\ncan be found on the [Posit Platform Support](https://posit.co/about/platform-support/)\npage. When an operating system has reached its end of support, builds for it\nwill be discontinued, but existing binaries will continue to be available.\n\n## Supported R Versions\n\nR binaries are primarily supported for the current R version and previous four minor versions of R.\nOlder 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. \n\nR versions 4.0.0 through 4.3.3 have been patched for [CVE-2024-27322](https://nvd.nist.gov/vuln/detail/cve-2024-27322). See [#218](https://github.com/rstudio/r-builds/issues/218) for more details.\n\n## Quick Installation\n\nTo use our quick install script to install R, simply run the following\ncommand. To use the quick installer, you must have root or sudo privileges,\nand `curl` must be installed.\n\n```sh\nbash -c \"$(curl -L https://rstd.io/r-install)\"\n```\n\n## Manual Installation\n\n### Specify R version\n\nDefine the version of R that you want to install. Available versions\nof R can be found here: https://cdn.posit.co/r/versions.json\n```bash\nR_VERSION=4.3.3\n```\n\n### Download and install R\n#### Ubuntu/Debian Linux\n\nDownload the deb package:\n```bash\n# Ubuntu 20.04\ncurl -O https://cdn.posit.co/r/ubuntu-2004/pkgs/r-${R_VERSION}_1_amd64.deb\n\n# Ubuntu 22.04\ncurl -O https://cdn.posit.co/r/ubuntu-2204/pkgs/r-${R_VERSION}_1_amd64.deb\n\n# Ubuntu 24.04\ncurl -O https://cdn.posit.co/r/ubuntu-2404/pkgs/r-${R_VERSION}_1_amd64.deb\n\n# Debian 12\ncurl -O https://cdn.posit.co/r/debian-12/pkgs/r-${R_VERSION}_1_amd64.deb\n```\n\nThen install the package:\n```bash\nsudo apt-get install ./r-${R_VERSION}_1_amd64.deb\n```\n\n#### RHEL/CentOS Linux\n\nEnable the [Extra Packages for Enterprise Linux](https://fedoraproject.org/wiki/EPEL)\nrepository (RHEL/CentOS 7 and RHEL 9 only):\n\n```bash\n# CentOS / RHEL 7\nsudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm\n\n# Rocky Linux 9 / AlmaLinux 9\nsudo dnf install dnf-plugins-core\nsudo dnf config-manager --set-enabled crb\nsudo dnf install epel-release\n\n# RHEL 9\nsudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm\n```\n\n\u003e On RHEL 7, you may also need to enable the Optional repository:\n\u003e ```bash\n\u003e sudo subscription-manager repos --enable \"rhel-*-optional-rpms\"\n\u003e\n\u003e # If running RHEL 7 in a public cloud, such as Amazon EC2, enable the\n\u003e # Optional repository from Red Hat Update Infrastructure (RHUI) instead\n\u003e sudo yum install yum-utils\n\u003e sudo yum-config-manager --enable \"rhel-*-optional-rpms\"\n\u003e ```\n\n\u003e On RHEL 9, you may also need to enable the CodeReady Linux Builder repository:\n\u003e ```bash\n\u003e sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms\n\u003e \n\u003e # If running RHEL 9 in a public cloud, such as Amazon EC2, enable the CodeReady\n\u003e # Linux Builder repository from Red Hat Update Infrastructure (RHUI) instead\n\u003e sudo dnf install dnf-plugins-core\n\u003e sudo dnf config-manager --enable codeready-builder-for-rhel-9-*-rpms\n\u003e ```\n\nDownload the rpm package:\n```bash\n# CentOS / RHEL 7\ncurl -O https://cdn.posit.co/r/centos-7/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n\n# RHEL 8 / Rocky Linux 8 / AlmaLinux 8\ncurl -O https://cdn.posit.co/r/centos-8/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n\n# RHEL 9 / Rocky Linux 9 / AlmaLinux 9\ncurl -O https://cdn.posit.co/r/rhel-9/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n```\n\nThen install the package:\n```bash\nsudo yum install R-${R_VERSION}-1-1.x86_64.rpm\n```\n\n#### SUSE Linux\n\nDownload the rpm package:\n```bash\n# openSUSE 15.6 / SLES 15 SP6\ncurl -O https://cdn.posit.co/r/opensuse-156/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n```\n\nThen install the package:\n```bash\nsudo zypper --no-gpg-checks install R-${R_VERSION}-1-1.x86_64.rpm\n```\n\n#### Fedora Linux\n\nDownload the rpm package:\n```bash\n# Fedora 40\ncurl -O https://cdn.posit.co/r/fedora-40/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n\n# Fedora 41\ncurl -O https://cdn.posit.co/r/fedora-41/pkgs/R-${R_VERSION}-1-1.x86_64.rpm\n```\n\nThen install the package:\n```bash\nsudo dnf install r-${R_VERSION}_1_amd64.rpm\n```\n\n\n\n### Verify R installation\n\nTest that R was successfully installed by running:\n```bash\n/opt/R/${R_VERSION}/bin/R --version\n```\n\n### Add R to the system path\n\nTo ensure that R is available on the system path, create symbolic links to\nthe version of R that you installed:\n\n```bash\nsudo ln -s /opt/R/${R_VERSION}/bin/R /usr/local/bin/R \nsudo ln -s /opt/R/${R_VERSION}/bin/Rscript /usr/local/bin/Rscript\n```\n\n### Optional post-installation steps\n\nYou may want to install additional system dependencies for R packages.\nWe recommend installing a TeX distribution (such as [TinyTeX](https://yihui.name/tinytex/)\nor TeX Live) and Pandoc. For more information on system dependencies, see\n[system requirements for R packages](https://github.com/rstudio/r-system-requirements).\n\nIf you want to install multiple versions of R on the same system, you can\nrepeat these steps to install a different version of R alongside existing versions.\n\n---\n\n# Developer Documentation\n\nThis repository orchestrates builds using a variety of tools. The\ninstructions below outline the components in the stack and describe how to add a\nnew platform or inspect an existing platform.\n\n## Building from source\n\nTo build the R binaries from source, you will need to have [Git](https://git-scm.com/),\n[Docker](https://docs.docker.com/get-docker/), and `make` installed.\n\nFirst, clone the Git repository locally and navigate to it.\n\n```bash\ngit clone https://github.com/rstudio/R-builds\ncd R-builds\n```\n\nThen, run the `build-r-$PLATFORM` Make target with the `R_VERSION` environment variable\nset to your desired R version, where `$PLATFORM` is one of the supported platform\nidentifiers, such as `ubuntu-2204` or `rhel-9`.\n\n```bash\nexport PLATFORM=ubuntu-2204\nexport R_VERSION=4.1.3\n\nmake build-r-$PLATFORM\n```\n\nThe built DEB or RPM package will be available in the `builder/integration/tmp/$PLATFORM`\ndirectory.\n\n```bash\n$ ls builder/integration/tmp/$PLATFORM\nr-4.1.3_1_amd64.deb\n```\n\n### Custom installation path\n\nR is installed to `/opt/R/${R_VERSION}` by default. If you want to customize the\ninstallation path, set the optional `R_INSTALL_PATH` environment variable to a\ncustom location such as `/opt/custom/R-4.1.3`.\n\n```bash\nexport PLATFORM=rhel-9\nexport R_VERSION=4.1.3\nexport R_INSTALL_PATH=/opt/custom/R-4.1.3\n\nmake build-r-$PLATFORM\n```\n\n## Submitting pull requests\n\nFor significant changes to the R builds, such as adding a new platform or updating existing builds,\ninclude any relevant testing notes and changes that may affect existing users, such as system dependency changes.\n\nOn successful merge, the changes will be automatically deployed to the staging environment.\n\nA project maintainer can then trigger the builds in staging to test the changes, and then deploy/build in production\nwhen the changes have been verified.\n\n## Adding a new platform.\n\n### R configuration\n\n- Builds should use OpenBLAS and align their BLAS/LAPACK configuration with the default distribution of R when possible,\n  for maximum compatibility of binary R packages across R distributions. For example, Ubuntu/Debian should be configured\n  to use external BLAS, RHEL 9+ should use FlexiBLAS (to match EPEL), and SUSE should use shared BLAS. The BLAS/LAPACK\n  library should be swappable at runtime when possible.\n- DEB/RPM packages should include the minimum set of dependencies when possible. Different R versions may have different\n  dependencies, so packaging scripts may conditionally add dependencies based on the R version.\n\n### README\n\n1. Add the new platform to the `Supported Platforms` list.\n2. Add DEB or RPM package download instructions for the new platform.\n\n### Dockerfile\n\nCreate a `builder/Dockerfile.platform-version` (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.) This file must contain four major tasks:\n\n1. an `OS_IDENTIFIER` env with the `platform-version`.\n2. a step which ensures the R source build dependencies are installed\n3. The `awscli` for uploading packages and tarballs to S3\n4. `COPY` for the packaging script (`builder/package.platform-version`) to `/package.sh`\n5. `COPY` and `ENTRYPOINT` for the `build.sh` file in `builder/`.\n\n### Packaging script\n\nCreate a `builder/package.platform-version` script (where `platform-version` is `ubuntu-2204` or `centos-7`, etc.). \n\n### docker-compose.yml\n\nA new service in the docker-compose file named according to the `platform-version` and containing the proper entries:\n\n```yaml\nubuntu-2404:\n  command: ./build.sh\n  environment:\n    - R_VERSION=${R_VERSION}  # for testing out R builds locally\n    - R_INSTALL_PATH=${R_INSTALL_PATH}  # custom installation path\n    - LOCAL_STORE=/tmp/output  # ensures that output tarballs are persisted locally\n  build:\n    context: .\n    dockerfile: Dockerfile.ubuntu-2404\n  image: r-builds:ubuntu-2404\n  volumes:\n    - ./integration/tmp:/tmp/output  # path to output tarballs\n```\n\n### Job definition\n\nIN `serverless-resources.yml` you'll need to add a job definition that points to the ECR image.\n\n```yaml\nrBuildsBatchJobDefinitionUbuntu2404:\n  Type: AWS::Batch::JobDefinition\n  Properties:\n    Type: container\n    ContainerProperties:\n      Command:\n        - ./build.sh\n      Vcpus: 4\n      Memory: 4096\n      JobRoleArn:\n        \"Fn::GetAtt\": [ rBuildsEcsTaskIamRole, Arn ]\n      Image: !Sub \"${AWS::AccountId}.dkr.ecr.${AWS::Region}.amazonaws.com/r-builds:ubuntu-2404\"\n    Timeout:\n      AttemptDurationSeconds: 7200\n```\n\n### Environment variables in the serverless.yml functions.\n\nThe serverless functions which trigger R builds need to be informed of new platforms.\n\n1. Add a `JOB_DEFINITION_ARN_PlatformVersion` env variable with a ref to the Job definition above.\n2. Append the `platform-version` to `SUPPORTED_PLATFORMS`.\n\n```yaml\nenvironment:\n  # snip\n  JOB_DEFINITION_ARN_debian_11:\n    Ref: rBuildsBatchJobDefinitionDebian11\n  SUPPORTED_PLATFORMS: debian-10,centos-7,centos-8\n```\n\n### Makefile\n\nIn order for the makefile to push these new platforms to ECR, add them to the `PLATFORMS` variable near the top of the Makefile.\n\n### test/docker-compose.yml\n\nA new service in the `test/docker-compose.yml` file named according to the `platform-version` and containing the proper entries:\n\n```yaml\n  ubuntu-2204:\n    image: ubuntu:jammy\n    command: /r-builds/test/test-apt.sh\n    environment:\n      - OS_IDENTIFIER=ubuntu-2204\n      - R_VERSION=${R_VERSION}\n    volumes:\n      - ../:/r-builds\n```\n\n### Quick install script\n\nUpdate the quick install script at [`install.sh`](install.sh), if necessary, to support the new platform.\n\nOnce you've followed the steps above, submit a pull request.\n\n## R builds tarballs\n\nIn addition to the DEB and RPM packages, R builds also publishes tarballs of the binaries at: `https://cdn.posit.co/r/${OS_IDENTIFIER}/R-${R_VERSION}-${OS_IDENTIFIER}.tar.gz`.\nThese may be used with a manual installation of R's system dependencies. System dependencies will differ between R versions,\nso inspect the corresponding DEB or RPM package for the list of system dependencies.\n\n## \"Break Glass\"\n\nPeriodically, someone with access to these resources may need to re-trigger every R version/platform combination. This quite easy with the `serverless` tool installed.\n\n```bash\n# Rebuild all R versions\nserverless invoke stepf -n rBuilds -d '{\"force\": true}'\n\n# Rebuild specific R versions\nserverless invoke stepf -n rBuilds -d '{\"force\": true, \"versions\": [\"3.6.3\", \"4.0.2\"]}'\n```\n\n## Testing\n\nTests are automatically run on each push that changes a file in `builder/`, `test/`, or the `Makefile`.\nThese tests validate that R was correctly configured, built, and packaged. By default, the tests run\nfor the last 5 minor R versions on each platform.\n\nTo run the tests manually, you can navigate to the [GitHub Actions workflow page](https://github.com/rstudio/r-builds/actions/workflows/test.yml)\nand use \"Run workflow\" to run the tests from a custom branch, list of platforms, and list of R versions.\n\nTo skip the tests, add `[skip ci]` to your commit message. See [Skipping workflow runs](https://docs.github.com/en/actions/managing-workflow-runs/skipping-workflow-runs)\nfor more information.\n\nTo test the R builds locally, you can use the `build-r-$PLATFORM` and `test-r-$PLATFORM`\ntargets to build R and run the tests. The tests use the quick install script to install R,\nusing a locally built R if present, or otherwise a build from the CDN.\n\n```bash\n# Build R 4.1.3 for Ubuntu 22\nR_VERSION=4.1.3 make build-r-ubuntu-2204\n\n# Test R 4.1.3 for Ubuntu 22\nR_VERSION=4.1.3 make test-r-ubuntu-2204\n```\n\nAlternatively, you can build an image using the `docker-build-$PLATFORM`\ntarget, launch a bash session within a container using the `bash-$PLATFORM` target,\nand interactively run the build script:\n\n```bash\n# Build the image for Ubuntu 22\nmake docker-build-ubuntu-2204\n\n# Launch a bash session for Ubuntu 22\nmake bash-ubuntu-2204\n\n# Build R 4.1.3\nR_VERSION=4.1.3 ./build.sh\n\n# Build R devel with parallel execution to speed up the build\nMAKEFLAGS=-j4 R_VERSION=devel ./build.sh\n\n# Build a prerelease version of R (e.g., alpha or beta)\nR_VERSION=rc R_TARBALL_URL=https://cran.r-project.org/src/base-prerelease/R-latest.tar.gz ./build.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fr-builds","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frstudio%2Fr-builds","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frstudio%2Fr-builds/lists"}