Package for the current R 4.2. release* are available for most stable Desktop releases of Ubuntu until their official end of life date. However, only the latest Long Term Support (LTS) release is fully supported. As of May 2, 2022 the supported releases are
- Jammy Jellyfish (22.04, amd64 only)
- Impish Indri (21.10, amd64 only),
- Focal Fossa (20.04; LTS and amd64 only),
- Bionic Beaver (18.04; LTS), and
- Xenial Xerus (16.04; LTS).
Run these lines (if
sudo) to tell Ubuntu about the R binaries at CRAN.
# update indices sudo apt update -qq # install two helper packages we need sudo apt install --no-install-recommends software-properties-common dirmngr # add the signing key (by Michael Rutter) for these repos # To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc # Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9 wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc # add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
Here we use
lsb_release -cs to access which Ubuntu flavor you run: one of “jammy”, impish”, “focal”, “bionic”, …
sudo apt install --no-install-recommends r-base
to to install R and its dependencies.
For more detailed instructions, including details on administration and maintenance of R Packages, see the full README.
For older R releases, see the corresponding README.
Get 5000+ CRAN Packages
Run this command (as
root or by prefixing
sudo) to add the current R 4.0 or later ‘c2d4u’ repository:
sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+
to add the key id for this repository, add the repository, and update the index. You can now do
apt install --no-install-recommends r-cran-rstan or
apt install --no-install-recommends r-cran-tidyverse (again as user
root or via
The ‘c2d4u’ repository is only available for LTS releases. If you wish to attempt to use the repository with an non-LTS release, you can manually edit the ’c2d4u_team-ubuntu-c2d4u4_0_-*.list’ to use focal instead of the intended release. This usage of the ‘c2d4u’ repository is unsupported. An LTS release is strongly suggested for utilizing the ‘c2d4u’ repository.
The Debian R packages are maintained by Dirk Eddelbuettel. The Ubuntu packages are compiled for i386 and amd64 by Michael Rutter (firstname.lastname@example.org) using scripts developed by Vincent Goulet.