You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Welcome to our guide on how to install R & RStudio on CentOS 8 / RHEL 8 Linux. R is a popular programming language used for graphical representation of data and statistical computing. If you are a full time R developer, you’ll need a version of IDE. This is where RStudio come in. RStudio is a set of integrated tools designed to help R developers be more productive and efficient.

Rstudio comes with robust tools for plotting, viewing history, debugging and managing your workspace. Two versions of RStudio are available – open source or commercial. Pick the version that works best for your business needs.

Features of RStudio

  • Runs on Windows, Linux, and macOS
  • Syntax highlighting, code completion, and smart indentation
  • Integrated support for Git and Subversion
  • Execute R code directly from the source editor
  • Quickly jump to function definitions
  • Easily manage multiple working directories using projects
  • Integrated R help and documentation
  • Interactive debugger to diagnose and fix errors quickly
  • Extensive package development tools
  • Support for interactive graphics with Shiny and ggvis
  • Supports authoring HTML, PDF, Word Documents, and slide shows

By choosing the commercial edition, you get additional features such as Access to priority email support and 8 hour response during business hours (ET). Learn more about RStudio editions and features.

Install R & RStudio on CentOS 8 / RHEL 8

Now that we’ve covered the basics of R and RStudio, let’s now proceed to actual installation. Ensure the system is updated before you continue.

sudo yum update

Once the system is updated, add the EPEL repositories:

--- CentOS 8 ---
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf config-manager --set-enabled PowerTools

--- RHEL 8 ---
sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo ARCH=$( /bin/arch )
sudo subscription-manager repos --enable "codeready-builder-for-rhel-8-${ARCH}-rpms"

Install R on CentOS 8 / RHEL 8 Linux:

We’ll use an automated script to install R on CentOS 8 / RHEL 8 Linux system.

sudo bash -c "$(curl -L https://rstd.io/r-install)"

It will show you all the available versions of R, you can select specific version from the list to install.

Available Versions
  3.6.3
  3.6.2
  3.6.1
  3.6.0
  3.5.3
  3.5.2
  3.5.1
  3.5.0
  3.4.4
  3.4.3
  3.4.2
  3.4.1
  3.4.0
  3.3.3
  3.3.2
  3.3.1
  3.3.0
  3.2.5
  3.2.4
  3.2.3
  3.2.2
  3.2.1
  3.2.0
  3.1.3
  3.1.2
  3.1.1
  3.1.0
  3.0.3
  3.0.2
  3.0.1
  3.0.0
Enter version to install: (<ENTER> for latest)

To install the latest version, just hit the <Enter> key.

Transaction Summary
========================================================================================================================================================
Install  30 Packages

Total size: 134 M
Total download size: 77 M
Installed size: 329 M
Is this ok [y/N]: y

Print the current version of R installed.

/opt/R/${R_VERSION}/bin/R --version

You can add the path to R binary to your $PATH.

$ vim ~/.bashrc
export PATH=$PATH:/opt/R/${R_VERSION}/bin/R --version

Where ${R_VERSION} is the version of your R installed. In my case this will be:

export PATH=$PATH:/opt/R/3.6.3/bin/

Source the bashrc file and confirm:

$ source .bashrc 
$ which R
/opt/R/3.6.3/bin/R
$ R --version
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under the terms of the
GNU General Public License versions 2 or 3.
For more information about these matters see
https://www.gnu.org/licenses/.

Install RStudio on CentOS 8 / RHEL 8:

Now visit the  RStudio downloads page to grab the latest release of RStudio for RHEL / CentOS Linux.

sudo yum -y install wget
wget https://download1.rstudio.org/desktop/fedora28/x86_64/rstudio-1.2.5042-x86_64.rpm

Install the RPM package downloaded using yum or rpm command.

sudo yum localinstall ./rstudio-1.2.5042-x86_64.rpm

Agree to install RStudio on RHEL / CentOS 8 Linux.

Dependencies resolved.
======================================================================================
 Package           Architecture     Version              Repository              Size
======================================================================================
Installing:
 rstudio           x86_64           1.2.5042-1           @commandline           115 M

Transaction Summary
======================================================================================
Install  1 Package

Total size: 115 M
Installed size: 582 M
Is this ok [y/N]: y

Launch RStudio from CLI or Desktop environment and start your R Development.

More Dev related content for CentOS / RHEL 8 Linux.

Install Apache Cassandra on CentOS 8 Linux

How To Install Java 11 (OpenJDK 11) on RHEL 8 / CentOS 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF