Install R on any Linux Distro (Debian, Fedora/Redhat, Ubuntu)

Learn how to install R, a popular programming language for data analysis and visualization, on any Linux distro including Debian, Fedora/Redhat, and Ubuntu with this simple tutorial.

Install R on any Linux Distro (Debian, Fedora/Redhat, Ubuntu)
Image by Cris DiNoto / Unsplash

R is an open-source programming language mainly used by statisticians and data scientists to perform statistical analysis. It is great for statistical computing, with robust features for generating detailed statistical visualizations.

The R packages included in the default repositories are often outdated. We will install the latest R package from the CRAN repository.

New article β€” Lightweight Linux Distros perfect for older hardware.

How to Install R on Linux Distros (Debian, Fedora/Redhat, Ubuntu)

This guide covers the 4 specific ways to install R on Linux distributions.

System Requirements

  • RAMβ€” 1 GB required, 2 GB recommended.
  • a non-root with sudo privileges on the user account.

1. Install R from the terminal

Type in the following commands in terminal.

Install dependencies

sudo apt install dirmngr gnupg apt-transport-https ca-certificates software-properties-common

Add the CRAN repository to your system

sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu focal-cran40/'

Install R by typing

sudo apt install r-base

Verify the R version

R --version

2. Download via Homebrew

You can download R by typing a homebrew command:

brew install r

3. Download via XCode

Type the following command to install R through XCode:

xcode-select --install

4. Download R with the Web Browser

You can get the latest R package from cran.r-project.org

That’s it!

You are ready.