Install R on Ubuntu 12.04


Each time I install R, I have to read documentation. This time I decided to write my own small version of installation documentation. So here we go 🙂

Step 1 : Update your package repository so that you can get R 3.x

Use nano to open source.list (command below)

sudo nano /etc/apt/sources.list

Now update sources.list with the folling line (just insert at the bottom of file).

deb precise/

and Ctrl X will take you out of nano, it will ask to save file say ‘Y’.

Add key to authenticate CRAN packages

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

otherwise you will get an error similar to this

W: GPG error: precise/ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY .................

Step 2: Now update packages by using the following command

sudo apt-get update

if you get message like

Reading package lists... Done

it means you are ready to go with installation. Run the command below

sudo apt-get install r-base

Now confirm by running R to see if it is working fine.

Good luck.

To install rgdal package, have a look at “Installing rgdal package for R3“.

To install R 3.2.0 on Ubuntu 140.4, following the instruction below.