Report this

What is the reason for this report?

How To Install R on Ubuntu 20.04 [Quickstart]

Published on May 19, 2020
English
How To Install R on Ubuntu 20.04 [Quickstart]

Introduction

An open-source programming language, R specializes in statistical computing and graphics. In this tutorial, we will install R on an Ubuntu 20.04 server.

For a more detailed version of this tutorial, with more thorough explanations of each step, please refer to How To Install R on Ubuntu 20.04.

Step 1 — Adding GPG Key

Logged into your Ubuntu 20.04 server as a sudo non-root user, add the relevant GPG key.

  1. sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

Step 2 — Adding the R Repository

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

If you’re not using 20.04, find the relevant repository from the R Project Ubuntu list, named for each release.

Step 3 — Updating Package Lists

  1. sudo apt update

Step 4 — Installing R

  1. sudo apt install r-base

Step 5 — Testing the Installation

Start R’s interactive shell as root.

  1. sudo -i R

You should receive output similar to the following:

Output
R version 4.0.0 (2020-04-24) -- "Arbor Day" Copyright (C) 2020 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) ... Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. >

This confirms that we’ve successfully installed R and entered its interactive shell.

Here are links to more detailed tutorials that are related to this guide:

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author

Lisa Tagliaferri
Lisa Tagliaferri
Author
See author profile

Community and Developer Education expert. Former Senior Manager, Community at DigitalOcean. Focused on topics including Ubuntu 22.04, Ubuntu 20.04, Python, Django, and more.

Still looking for an answer?

Was this helpful?


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Creative CommonsThis work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License.
Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.