Installing R on Ubuntu 18.04 LTS

R is a programming language and environment for statistic data analysis and their graphical display. It is an implementation of programming language S under free license GNU General Public License. R can be expanded via libraries called packages. Home page is at r-project.org.

The guide describes installation of R from the official repository and testing functionality after installation.

Try out the performance of the premium VPS

Its better to try that than to hear about it – try out the professional Virtual server from Active24 for production usage for free.
Uncompromising dedicated performance, snapshots for free, SSD for all your data.
More atactive24.cz/servery (only available for CZ and SK markets)


Guide for installation of R

Hint: Before you use this guide, we would recommend to have a knowledge of installing packages on the server and editing configuration via console to one of the editors.

1. Add GPG key repository

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

2. Add R repository

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

3. Update the repository and install updates for packages

sudo apt update 
sudo apt upgrade 

4. Install R package

sudo apt install r-base

Functionality test

sudo -i R
R version 3.6.1 (2019-07-05) -- "Action of the Toes"
 Copyright (C) 2019 The R Foundation for Statistical Computing

Traditional welcome message

> print("Hello world!")

Simple math

> 1 + 2 + 3

Quitting interactive shell

> q()
Updated on January 3, 2025

Was this article helpful?

Related Articles