Installing R

It is generally best to install R from CRAN rather than your distribution's repositories, due to R covering fields of science that develop quickly. In Ubuntu, this can still be done using apt. See for up-to-date information.

First install the CRAN key for apt:

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

Now create a new repo entry for CRAN by creating a file in /etc/apt/sources.list.d. The name of the file doesn't matter, but here is a reasonable suggestion:


Edit the file and add the appropriate line for your CRAN mirror of choice and your Ubuntu version, e.g.:

deb trusty/

Run sudo apt-get update in order to update the local package database (redhat: yum update; note that this will also attempt to upgrade all packages with available updates).

Install R: sudo apt-get install r-base r-base-dev