I don't know where to put this line in the file. Or is there the possibility to achieve it over the shell somehow? I'm using 14.04.


To obtain the latest R packages, add an entry like

deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu trusty/ or

deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu precise/ or

deb http://<my.favorite.cran.mirror>/bin/linux/ubuntu lucid/

in your /etc/apt/sources.list file, replacing <my.favorite.cran.mirror> by the actual URL of your favorite CRAN mirror. See http://cran.r-project.org/mirrors.html for the list of CRAN mirrors. To install the complete R system, use

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

My mirror would be: http://stat.ethz.ch/CRAN/

  • Do you really need the latest version? Version 3.0.2 is available from the standard repository for Ubuntu Trusty (without adding anything to your sources.list file) just by typing sudo apt-get update && sudo apt-get install r-base Jul 27, 2014 at 11:51
  • 1
    If one is doing anything bioconductor-related (which by now is a large portion of the R community), one must use the very latest stable R.
    – Gx1sptDTDa
    Jul 27, 2014 at 11:54

1 Answer 1


Add the following line to your /etc/apt/sources.list file. It doesn't matter where exactly, but end of the file is ok.

deb http://stat.ethz.ch/CRAN/bin/linux/ubuntu trusty/ #enabled-manually

If you insist on doing this in a terminal, do the following:

sudo su 
echo "deb http://stat.ethz.ch/CRAN/bin/linux/ubuntu trusty/ #enabled-manually" >> /etc/apt/sources.list

This will launch a super user session, and append the line to the sources.list file, after which we exit from the super user session.

Then, per the R installation instructions, one must add the public key of Michael Rutter to secure apt. Execute the following in a terminal:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9

Then simply do sudo apt-get update && sudo apt-get install r-base r-base-dev.

Happy R-ing!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.