---
title: "Ubuntu Packages For R - Brief Instructions"
output:
  minidown::mini_document:
    framework: water
    toc: yes
    toc_float: true
    tabset: true
---


## Install R

Packages for the *current R 4.5.* release* are available for Ubuntu 'Long Term Support' (LTS) releases until their official (extended) [end of life](https://ubuntu.com/about/release-cycle) date. 
However, only the latest LTS release is fully supported. 
Recent releases are build for amd64 (_i.e._, 64-bit Intel and AMD) and arm64 (_i.e._, M1/M2/M3, graviton etc) CPUs; older releases are also available for i386 CPUs.
As of April 15, 2025 the supported releases are 

- 24.04 ("noble", amd64 and arm64),
- 22.04 ("jammy", amd64 and arm64),
- 20.04 ("focal", amd64 and arm64),

Run the lines below (if as `root` use the second tab without `sudo`) to tell Ubuntu about the R binaries at CRAN, install R and its dependenciesm and set the repo up for updates.
This uses `lsb_release -cs` to pick the Ubuntu flavor you run: one of "noble", "jammy", "focal", ...
Note that 'cran40' denotes a binary compatibility break by the R 4.0.* release, it does not install R 4.0.* but the current R 4.5.* series.

### Installation Steps {.tabset}

#### User

```sh
# 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 repo from CRAN -- lsb_release adjusts to 'noble' or 'jammy' or ... as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
# install R itself
sudo apt install --no-install-recommends r-base
```

#### Root

```sh
# update indices
apt update -qq
# install two helper packages we need
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 | tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the repo from CRAN -- lsb_release adjusts to 'noble' or 'jammy' or ... as needed
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
# install R itself
sudo apt install --no-install-recommends r-base
```


## See Also

For more detailed instructions, including details on administration and maintenance of R Packages, see the [full README](fullREADME.html).
For older R releases, see the [corresponding README](olderreleasesREADME.html).

To install all (currently twenty-one-thousand) CRAN packages (as well as several hundred BioConductor packages) as Ubuntu binaries, use [r2u](https://github.com/eddelbuettel/r2u) which builds on top of these instructions and adds an additional repository. 
Details on how to set it up and install packages can be found at the [r2u project website](https://github.com/eddelbuettel/r2u). 

The [c2d4u project](https://launchpad.net/~c2d4u.team/+archive/ubuntu/c2d4u4.0+) provided (parts of) CRAN as binaries for many year, but is currently on hiatus and no longer updating packages. 
Hence please use [r2u](https://github.com/eddelbuettel/r2u) for CRAN binaries.

## Acknowledgements

The Debian R packages and the r2u project are maintained by Dirk Eddelbuettel. 
The Ubuntu packages are compiled by Michael Rutter (<marutter@gmail.com>) using scripts initially developed by Vincent Goulet. 
These instructions are provided by Michael and Dirk. 
Questions can be asked on the [r-sig-debian mailing list](https://stat.ethz.ch/mailman/listinfo/r-sig-debian) for R on Debian, Ubuntu, and other derivative distros.
