GUI method
- In the Ubuntu Software Center, click "Edit > Software sources..."
- On the "other software" tab, click "Add..."
- Enter the following settings:
- Type: Binary
- URI:
http://cran.fhcrc.org/bin/linux/ubuntu
- Distribution: trusty/
- Components:
- Comment: R CRAN
This creates a new "software source" that will be checked alongside the regular Ubuntu/Canonical software repositories. After you do this, you need to re-run sudo apt-get update
to query the new repository. After that, your system will default to installing R from the CRAN source rather than Canonical, since the CRAN source will always have an equal or greater version number.
Important notes
- the URI line can have lots of different values, and you should pick one that is geographically close to you from the list of CRAN mirrors.
cran.fhcrc.org
is in Seattle, USA.
- the Distribution line should match the "codename" of your Ubuntu version, which you can get by typing
lsb_release -cs
in a terminal window.
Terminal method
There are good instructions here. Briefly:
codename=$(lsb_release -c -s)
echo "deb http://cran.fhcrc.org/bin/linux/ubuntu $codename/" | sudo tee -a /etc/apt/sources.list > /dev/null
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9
sudo add-apt-repository ppa:marutter/rdev
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install r-base r-base-dev
Again, replace cran.fhcrc.org
with a geographically appropriate choice from the list of CRAN mirrors.