R installation on Linux

Table of Contents
Motivation
At Wageningen University & Research the Linux Operating System is supported on a best effort principle, meaning that it is supported as far as the knowledge of Facilities and Services Information Technology (FB-IT) reaches. FB-IT is supported by their colleagues maintaining the High Performance Computing Cluster Anunna, who have a lot of knowledge about the Linux Operating System, because it’s the Operating System used by Anunna.
On the other hand Linux users are generally users, who are very independent and know how to search for and implement solutions themselves. Being one of those Linux users within WUR myself I want to share in this post, how I have installed R on my Linux Systems within Wageningen University & Research.
This post will show how to install R on a Linux desk- or laptop computer.
Two types of Linux Operating Systems are described:
- Debian based, e.g. LMDE 5 Elsie (based on Debian 11 Bullseye)
- Ubuntu based, e.g. Linux Mint 20.3 (based on Ubuntu 20.04.4 LTS a.k.a. Focal Fossa)
Installation R
Debian based Linux Operating System
The installation procedure described here, combines information as provided on https://cloud.r-project.org/bin/linux/debian/. At the time of writing this post the described procedure installs R version 4.2.0 (nicknamed: Vigorous Calisthenics), under the assumption that the Linux Operating System is based on Debian 11 Bullseye. When you are using Debian 12 Bookworm, replace bullseye
with bookworm
in the commands provided below.
- Open a terminal (CTRL+ALT+T) and log in as administrator using the console command:
sudo -i
- Fetch and import the current key. When a message appears that
apt-key
is deprecated, use the second command starting withgpg
.
apt-key adv --keyserver keyserver.ubuntu.com --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'
gpg --armor --export '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' | tee /etc/apt/trusted.gpg.d/cran_debian_key.asc
- Add Debian bullseye repository to the software sources using the command:
add-apt-repository "deb http://cloud.r-project.org/bin/linux/debian bullseye-cran40/"
- Update the package information from all configured sources:
apt update
- Fully install R with dependencies:
apt install r-base libatlas3-base libopenblas-base r-cran-littler r-cran-coda r-doc-info r-doc-pdf python3-rpy2 r-mathlib
- Exit out of administrator mode using the
exit
command.
Ubuntu based Linux Operating System
The installation procedure described here, combines information as provided on https://cloud.r-project.org/bin/linux/ubuntu/fullREADME.html. At the time of writing this post the described procedure installs R version 4.2.0 (nicknamed: Vigorous Calisthenics), under the assumption that the Linux Operating System is based on Ubuntu 20.04.4 LTS Focal Fossa. When using a newer version of Ubuntu LTS replace the name of the version used in the commands below, e.g., for Ubuntu 24.04 LTS use noble
instead of focal
.
- Open a terminal (CTRL+ALT+T) and log in as administrator using the console command:
sudo -i
- Fetch and import the current key. When a message appears about deprecation of
apt-key
, use the second command starting withwget
.
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 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 Ubuntu Focal Fossa repository to the software sources using the command:
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/"
- Update the package information from all configured sources:
apt update
- Fully install R with dependencies:
apt install r-base r-cran-littler r-cran-rodbc r-doc-info r-doc-pdf r-mathlib elpa-ess ess jags littler python3-rpy2
- Exit out of administrator mode using the
exit
command.