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.


  1. Mike Spencer says:

    You can set this up as terminal commands and avoid having to physically type and browse the web for files. You should update the repository to your local one (info here: within these commands:

    # Get the latest R version
    sudo apt-key adv –keyserver –recv-keys E084DAB9
    sudo add-apt-repository ‘deb trusty/’
    sudo apt-get update
    sudo apt-get install r-base

    # Download and install RStudio
    sudo dpkg -i *.deb
    rm *.deb

    The main advantage with this approach is that you can make an install script for your setup, which makes maintaining multiple machines much easier and upgrades/rebuilds nearly painless. You can see mine here: which will set you up with pretty much all the spatial science software you could need.

  2. Michael Rutter says:

    May I suggest using the RRutter launchpad PPA for easier installiation of R for Ubununtu? You can use “apt-add-repository” to install the PPA. Details here: This PPA seeds the CRAN Ubuntu sites, so the packages are identical.

    Also check out c2d4u for Ubuntu packages for over 1000 R packages.

  3. Dhana says:

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

    might be useful to install more libraries.

  4. Guansong says:

    When I installed R, I had to add a “key” with the command:

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

  5. Sharma KMS says:

    I have tried in my desk top. The file opens with Software center and strats installation. But fails. Do not know the reason why? Could you help?

  6. Jeroen says:

    You can also pull the latest r and rstudio from launchpad:

    sudo add-apt-repository ppa:opencpu/rstudio
    sudo apt-get update
    sudo apt-get install rstudio-server

  7. weidong says:

    how to open the downloaded file in the software center? I can not find the file in the software center.

  8. Ken Kleinman says:

    This was incredibly helpful, folks. Thanks a million!

  9. Chris Beeley says:

    May be of interest, my quickstart guide to setting up a new Linux install, it’s mainly for my own use but I’ve blogged it in case others find it useful.

    (I much prefer the Linux Mint desktop to the vanilla Ubuntu version but it’s a matter of taste, of course).

  10. KEDAR says:

    Thanks. Worked perfectly .

  11. Mohammad says:

    I followed this and have a problem when loading rstudio:

    R shared library (/usr/local/lib/R/lib/ not found. If this is a custom build of R, was it built with the –enable-R-shlib option?

    I had a older version of R on this machine (the default) and Rstudio worked with it perfectly. The I tried to upgrade to R-3.2 using installing from source and this happened! anyone know why?

  12. RanjithKumar Ragavan says:

    Works great!!

  13. M. Book says:

    When editing the source.list, don’t forget to include the command ‘deb’ at the beginning, e.g.,
    deb https:///bin/linux/ubuntu trusty/

  14. mateo says:

    Thank you very much. Too usefull for me

  15. bozboruzu says:

    Hi there thertrader
    I’m not great at maths,command line editing is a bit steep learning curve. Following your instructions installing RStudio was a breeze. Thanks you,it works wonder !

  16. Phuong says:

    Hi all,
    I have followed the same process to install R, RStudio with Ubuntu 15.10 (already add Willy to repository). R installed successfully but RStudio could not start. I tried many times but RStudio did not open when I clicked on the RStudio icon after search. Any comments? Thanks

  17. Phuong says:

    Hi all,
    I tried with Ubuntu 15.10. R is installed and worked smoothly but RStudio cannot open.

    • The R Trader says:


      I’m using mainly Windows and my Linux post was just an attempt to test another working environment. Given the financial world huge dependency on Excel, I don’t think I’ll move to Linux any time soon. I think it’s under optimal but that’s they way it is. To cut a long story short, I’m far from being a Linux expert and given the little information you provide even if I was I’m not sure I could help 🙂

Leave a Reply