Install R in Ubuntu Linux [Step by step guide]

R is one of the most popular open source programming languages. And when it comes to statistical processing and data science, R is one of the top languages.

If you’re using Windows, then it is easy to install R. But when it comes to Ubuntu and Linux, it is not that simple. But this guide is going to help you install R in Ubuntu or Linux.

R is widely used for developing statistical software and data analysis. Almost all the company who deals in data analysis uses R. You will commonly hear that data cleaning and modeling is quoted easy and understandable.

install R in ubuntuR has thousands of packages which help us develop the machine learning models easily and do data messaging.

In this tutorial, we will install R in Ubuntu operating system. We will also see how to install packages in R in Ubuntu.

Install R in Ubuntu and Linux

Let’s see the steps followed while installing R on Ubuntu operating system. But before installing R on Ubuntu, let’s understand the perquisites for installing R in Ubuntu.

Perquisites of Installing R in Ubuntu

Here are some of the perquisites you need to have before installing-

  • Ubuntu 16.04 or higher
  • Minimum 1 GB RAM
  • User with sudo privilege

Step-1: Installing R with Openblas

Open the terminal on your system and execute the below command-

sudo apt-get install libopenblas-base r-base


Step-2: Install R-Studio

On the same open terminal, execute the below code-

sudo apt-get install gdebi
cd ~/Downloads
wget https://download1.rstudio.org/rstudio-xenial-1.1.419-amd64.deb
sudo gdebi rstudio-xenial-1.1.379-amd64.deb

With this, you’re already done with installing R and R-Studio in Ubuntu. Now let’s understand how to install packages in R in Ubuntu.

Step-3: Install Tidyverse packages

Open R Studio in your Ubuntu system and write the below command and execute

install.packages("tidyverse", repos = 'https://cran.us.r-project.org')

Step-4: Install other important packages

You may install other important R packages as well which will be of great use while working-

  • XML- Read and create XML documents in R
  • rvest- Used for web scrapping
  • readxl- for reading excel files
  • tidyr- for data cleaning and management in R
  • ggplot2- For plotting different graphs in R

And there are many other important R Packages which you can install and use.

install.packages(c("XML", "jsonlite", "httr", "rvest"))


This was the easiest way to install R in Ubuntu. I hope you followed this tutorial and was able to install this amazing open source software easily. You may also check the below video for any issue.

Additionally, you can comment below for any problem faced. For more such posts related to R, please check our R section.

Leave a Comment