Install R

Install and update R software on Linux

To get the most recent version of R, add the a CRAN repository to the list of APT sources.

a) Ubuntu

sudo add-apt-repository "deb trusty/"

sudo apt-key adv –keyserver –recv-keys E084DAB9

b) Debian

sudo add-apt-repository "deb jessie-cran3/"

gpg --keyserver --recv-key 381BA480

gpg -a --export 381BA480 | apt-key add -

Install R

sudo apt-get update

sudo apt-get install r-base

Upgrade R to a newer R version

sudo apt-get upgrade r-base

Start R by tying "R" Exit R by typing "q()"


R version 3.2.3 (2015-12-10) -- "Wooden Christmas-Tree"

Copyright (C) 2015 The R Foundation for Statistical Computing

Platform: x86_64-pc-linux-gnu (64-bit)


> 3*4 # simple calculation

[1] 12


> q() # exit (quit) R

Save workspace image? [y/n/c]: n

See also

sessionInfo() to get current R version

Install RStudio

comfortable R editor and programming tool

# Download and install RStudio on Ubuntu Linux (2018)


sudo dpkg -i rstudio-0.99.903-amd64.deb

Error: Package libjpeg62 is not installed ?

Start RSudio by typing rstudio in the command line.

RStudio on remote server


download "base" version

# for updating an older R version, uninstall the old version first before installing the latest version

read more


→ Install additional R packages