How to install R on Debian

Debian maintains R in its main package repository alongside the rest of the operating system. That integration suits statistical analysis, report generation, and noninteractive data jobs that need to follow the host's normal APT update policy.

The r-base metapackage installs the core interpreter and Debian's collection of recommended R packages. This route favors a distribution-tested runtime over receiving a newer upstream release before it reaches the active Debian repository.

APT should report matching installed and candidate versions after the package transaction. A separate Rscript expression without user or site startup files confirms that the noninteractive runtime used by scheduled jobs and CI systems can start successfully.

Steps to install R on Debian:

  1. Refresh the Debian package metadata.
    $ sudo apt update
  2. Install the R metapackage from the Debian repository.
    $ sudo apt install --yes r-base

    The r-base metapackage installs r-base-core and the recommended R packages maintained for the active Debian release.

  3. Inspect the installed and candidate r-base versions in APT.
    $ apt-cache policy r-base
    r-base:
      Installed: 4.5.0-3
      Candidate: 4.5.0-3
      Version table:
     *** 4.5.0-3 500
            500 http://deb.debian.org/debian trixie/main arm64 Packages
            100 /var/lib/dpkg/status

    The version and architecture can differ on another supported Debian release. The installed and candidate fields should match after installation.

  4. Evaluate an R expression without user or site startup files.
    $ Rscript --vanilla -e 'cat(R.version.string, "\n")'
    R version 4.5.0 (2025-04-11)