R provides a common runtime for statistical analysis, data processing, and reproducible reports. On Ubuntu, the distribution archive supplies a packaged runtime that receives updates through the same APT workflow as the rest of the operating system.
The r-base package installs the interactive R command, the noninteractive Rscript command, and the recommended base packages. This method stays with the version selected for the installed Ubuntu release instead of adding a third-party repository.
Ubuntu publishes r-base in the Universe repository component. Standard installations commonly enable Universe already, while reduced images and custom APT source sets may omit it; an unavailable-package error therefore points to the enabled Ubuntu components before it points to R itself.
Related: Install an R package from CRAN
Steps to install R on Ubuntu:
- Open a terminal with sudo privileges.
- Refresh the APT package index.
$ sudo apt update
- Install the R runtime from the Ubuntu archive.
$ sudo apt install --assume-yes r-base
The package version changes with the Ubuntu release and archive updates. The r-base metapackage also installs r-recommended and the noninteractive Rscript command.
- Check the installed package source.
$ apt-cache policy r-base r-base: Installed: 4.5.2-1ubuntu2 Candidate: 4.5.2-1ubuntu2 Version table: *** 4.5.2-1ubuntu2 500 500 http://archive.ubuntu.com/ubuntu resolute/universe arm64 Packages 100 /var/lib/dpkg/statusThe release name, architecture, mirror, and version differ between hosts. The installed and candidate values should identify the intended Ubuntu archive package.
- Confirm the installed R runtime version.
$ R --version R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: aarch64-unknown-linux-gnu ##### snipped #####
- Evaluate an expression with Rscript.
$ Rscript --vanilla -e 'mean(c(3, 7, 11))' [1] 7
The numeric result confirms that Rscript can start the installed runtime, parse an expression, and print its value without an interactive session.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.