Installing R/RStudio on Ubuntu 14.04

My last experience with Linux was back in 2002/2003. At that time pretty much everything on Linux was done in the console. I remmember struggling for days with a simple Wifi connection because drivers were not readily available. Things have changed dramatically since then. Last week I installed Linux (Ubuntu 14.04)  on an old Windows laptop. It took me about 20 mins to erase completely Windows, install Linux and start playing with R/Rstudio: simply amazing…. In this post I explain step by step what I did: bear in mind that I’m a Linux absolute beginner.

1 – Install Linux

  • Go to Ubuntu website and download the version that matches your system
  • Create a bootable USB key with the file downloaded above. I used a small utility called Rufus for this. Just follow the instructions on the website it’s very simple.

2 – Install R

Ubuntu 14.04 ships with R but it’s not the latest version. The latest version can be obtained from CRAN. An entry like :  http://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/ has to be added to the /etc/apt/sources.list file, replacing <my.favorite.cran.mirror> by the actual URL of your favorite CRAN mirror (see for the list of CRAN mirrors). Actually this is a bit  tricky because you need admin rights to modify the sources.list file. I used a small utility called gksudo to open and modify the sources.list file. In the command line type the following:

gksudo gedit /etc/apt/sources.list

This will open the sources.list file in gedit. You just need to add the repository above then save and close

You can then install the complete R system, by typing the following in the console:

sudo apt-get update
sudo apt-get install r-base

There are other ways of doing this but adding an entry to the sources.list file is apparently the prefered option. Ubuntu uses apt for package management. Apt stores a list of repositories (software channels) in the sources.list file. By editing this file from the command line, software repositories can be added or removed.

3 – Install RStudio

  • Go to RStudio website, choose and download the right package for your system
  • Open this file in Ubuntu Software Center
  • Click install and you’re done

if you want to have RStudio icon on the launcher (all the icons on the left hand side of the screen)

  • Go to Search and type RStudio, the RStudio icon should appear
  • Drag and Drop RStudio icon to the launcher

All this might not be perfect but it worked for me without a glitch. I wanted to share my experience because  I’m trully amazed by the improvements brought to Linux over the last few years.

As usual any comments welcome.

32 Responses to “Installing R/RStudio on Ubuntu 14.04”

Leave a Reply