How to install R on Fedora or Red Hat Enterprise Linux

R can run scripts and statistical workloads from RPM packages on Fedora 44 or Red Hat Enterprise Linux 9. Both paths keep the runtime under DNF, but RHEL needs the community-maintained Extra Packages for Enterprise Linux (EPEL) repository before R-core becomes available.

Fedora provides R-core in its standard repositories. RHEL 9 instead needs an active Red Hat subscription, the matching CodeReady Linux Builder repository, and the EPEL 9 release package; using an EPEL release package for a different RHEL major version can create incompatible repository definitions.

The focused R-core package supplies a functional runtime without the full development and Java metapackages. EPEL is outside Red Hat's production support coverage, and packages that compile native code may also require R-core-devel plus system libraries; the final Rscript calculation proves either installed runtime can execute noninteractive R code.

Steps to install R on Fedora or Red Hat Enterprise Linux:

  1. Open a terminal with sudo privileges.
  2. Install the focused R runtime package on Fedora 44.
    $ sudo dnf install -y R-core

    Fedora does not need the three RHEL-only repository steps below.

  3. Enable CodeReady Linux Builder on a subscribed RHEL 9 host.
    $ sudo subscription-manager repos --enable codeready-builder-for-rhel-9-$(arch)-rpms

    This command deliberately selects RHEL major version 9. A different RHEL major version needs its corresponding CodeReady repository and EPEL release package.

  4. Add the EPEL 9 release package on RHEL 9.
    $ sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

    EPEL packages are maintained by the Fedora community and are not covered by Red Hat production support.

  5. Install the focused R runtime package on RHEL 9.
    $ sudo dnf install -y R-core

    The R metapackage adds the development and Java components for hosts that need the broader package set.

  6. Confirm the installed R-core package on Fedora 44.
    $ rpm -q R-core
    R-core-4.6.1-1.fc44.aarch64
  7. Confirm the installed R-core package on RHEL 9.
    $ rpm -q R-core
    R-core-4.6.1-1.el9.aarch64

    The version, release, and architecture follow the enabled repositories and may differ after an update.

  8. Run a noninteractive R expression on the installed platform.
    $ Rscript -e '2 + 2'
    [1] 4