Skip to content

Instantly share code, notes, and snippets.

@antonkratz
Last active February 18, 2019 02:22
Show Gist options
  • Save antonkratz/2e2df414c795286610fb5883f0c0b00b to your computer and use it in GitHub Desktop.
Save antonkratz/2e2df414c795286610fb5883f0c0b00b to your computer and use it in GitHub Desktop.
install R and RStudio Server

Installing R on your own machine

The main guide on how to install R for any flavour of linux, binary or from source, is at http://cran.stat.ucla.edu/

Three different pathways to a working install, from simple to hard:

  • use the distributions package manager (easiest but not the most recent version)
  • install binary (recommended)
  • compile and install from source

I am assuming you are on Ubuntu 16.04 LTS.

use the distributions package manager

A very easy way to get R is to just

sudo apt-get install r-base r-base-dev

However, this will install the fairly old version R 3.2.3.

install a recent binary from CRAN mirror

If you want a newer version, I recommend R 3.4, not the most recent R 3.5, in this context. Here, the easiest way is to include a mirror by adding the line deb https://cloud.r-project.org/bin/linux/ubuntu xenial/ to your /etc/apt/sources.list file (requires sudo privileges). Also you need to add a key:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo apt-get update
sudo apt-get -y install r-base r-base-dev

Rstudio / Rstudio server

You most probably want to also install Rstudio or even Rstudio server.

Download and follow the instructions at: https://www.rstudio.com/products/rstudio/download/

For Ubuntu 16.04 LTS, this would be:

wget https://download1.rstudio.org/rstudio-xenial-1.1.456-amd64.deb
sudo apt -y install libjpeg62
sudo dpkg -i rstudio-xenial-1.1.456-amd64.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment