Skip to content

How to Install R Language in Ubuntu

How to Install R Language in Ubuntu 15.04, 14.10, 14.04 LTS and 12.04 LTS systems. Installing R packages on Ubuntu system

Category
Programming
Covers
Ubuntu
Versions & support
About Ubuntu →
On this page

R is a powerful open-source programming language used widely for data analysis and statistical computing. With its growing popularity, many users want to install R on their Ubuntu systems to start using it for their data analysis needs.

If you’re new to R or to installing software on Ubuntu, this step-by-step guide will help you install R on your Ubuntu systems.

Installing R on Ubuntu

You can install R programming language on Ubuntu with a few steps below:

  1. First update the indices on your system
    sudo apt update 
    
  2. Now install the following helper packagers
    sudo apt install --no-install-recommends software-properties-common dirmngr 
    
  3. Add the GPG key to your system
    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 
    
  4. Next configure the PPA on the ubuntu system.
    sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" 
    

    Here we use `lsb_release -cs` to access which Ubuntu flavor you run: one of “jammy”, impish”, “focal”, “bionic”, …

  5. Finally, install the R programming language with the following command.
    Then run

    sudo apt install --no-install-recommends r-base 
    

    This installs the R packages and dependencies on your system.

  6. Once the installation is finished, check the R version:
    R --version 
    

    This will display the version of R that you have installed. You should have R version 4.0.3 or higher.

Adding PPA for 5000+ CRAN Packages

The c2d4u contains 5000+ CRAN packages for the installation th Run this command (as root or by prefixing sudo) to add the current R 4.0 or later ‘c2d4u’ repository:

sudo add-apt-repository ppa:c2d4u.team/c2d4u4.0+ 

The ‘c2d4u’ repository is only available for LTS releases.

Conclusion

That’s it! You have now successfully installed R on your Ubuntu system. You can start using R for data analysis and statistical computing right away.

I hope this step-by-step guide has been helpful in installing R on your Ubuntu system.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top