Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How to install the R language interpreter? What is the package name? I have tried R, rlang, Rlang, rproject etc. but nothing works - neither apt-get nor Ubuntu Software center found R.

Is it possible to not included R in the official Ubuntu repositories?

share|improve this question

4 Answers 4

up vote 25 down vote accepted

Package you are asking of is r-base. So run the following command:

sudo apt-get install r-base

and you will have R in your system. Years ago I was also confused by this - such package name is stupid indeed.

share|improve this answer

The package you want is r-base Install r-base.

If you need to build R packages from source, you also need r-base-dev Install r-base-dev. (Most users probably don't need this.)

That's likely all you need to do.

Getting newer versions of R

The version of R probably your Ubuntu release's official software sources is likely sufficient. Assuming that's the case, you needn't read any further (except perhaps for entertainment).

But if you want/need the latest version, choose a CRAN mirror from the list. The do one of the following:

  • Make a .list file (you might call it r.list) in /etc/apt/sources.list.d with this line as its contents:

    deb http://your-cran-mirror/bin/linux/ubuntu trusty/

    If you're using Ubuntu 14.04 Trusty Tahr, you'll keep trusty as it is. Otherwise replace that word with the lower-case codename of whatever Ubuntu release you're using. (The first word only; the "animal name," not the "adjective.") They are listed here or on the releases page. For example, for Ubuntu 12.04 Precise Pangolin it is precise. For 14.10 Utopic Unicorn it will be utopic.

    This is the name listed in most or all of the similar deb lines in the configuration file /etc/apt/sources.list.

    To make your r.list file, you can open a Terminal windows (Ctrl+Alt+T) and run a command like this (making sure to substitute in your CRAN mirror of choice, and, if you're not running 14.04, your release codename):

    echo 'deb http://your-cran-mirror/bin/linux/ubuntu trusty/' | sudo tee -a /etc/apt/sources.list.d/r.list

    For example, on an Ubuntu 15.04 Vivid Vervet system located in the northeastern United States, I used:

    echo 'deb http://cran.mirrors.hoobly.com/bin/linux/ubuntu vivid/' | sudo tee -a /etc/apt/sources.list.d/r.list
  • Or, instead of adding the software source in its own configuration file, add that line to the master software sources configuration file, /etc/apt/sources.list. You can open that file up in a graphical text editor by opening a Terminal window (Ctrl+Alt+T) and running the command:

    sudo -H gedit /etc/apt/sources.list

Add the signing key for the CRAN repositories (you can verify it here):

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

If that fails, this way may work:

gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E084DAB9
gpg -a --export E084DAB9 | sudo apt-key add -

To activate the new software sources configuration, run:

sudo apt-get update

Then to install (or upgrade to) the version of R for CRAN:

sudo apt-get install r-base

(You can install r-base-dev and any other needed packages similarly. sudo apt-get upgrade will typically upgrade any R packages that have newer versions, if an older version is installed; you don't have to enter their names individually.)

Further reading / source cited:

For more details and information about other supporting packages available for installation on Ubuntu systems, see "UBUNTU PACKAGES FOR R".

  • The above answer is (very) loosely adapted from (a small) part of that README.
  • The commands for importing the CRAN signing key are drawn directly from it, though my instructions are in my own words, and simplified.
share|improve this answer
Adding the above line in sources.list results in an error saying the line is incorrectly formatted. The below thread says that this is the correct format to add the source name "deb stat.ethz.ch/CRAN/bin/linux/ubuntu trusty/ #enabled-manually" askubuntu.com/questions/503270/… Please correct me if I am wrong. I am a newbie, but this worked for me. –  Erdnase Aug 26 '14 at 14:40
@Erdnase Sorry! You're right about the / after the release name. I've added that to this post--thanks! (The part starting with # is a commen and is optional.) –  Eliah Kagan Aug 26 '14 at 15:18
Your images need updating. –  Tim May 8 at 13:50
@Tim What images? –  Eliah Kagan May 8 at 14:07
@The install r-base ones? Maybe it's my school blocking them. –  Tim May 8 at 14:10

Edit: It is included in the Ubuntu repositories, but they want you to install from theirs.



R packages for Ubuntu on i386 and amd64 are available for all stable Desktop releases of Ubuntu until their official end of life date. However, only the latest Long Term Support (LTS) release is fully supported. As of October 17, 2013, the supported releases are Trusty Tahr (14.04), Precise Pangolin (12.04; LTS), and Lucid Lynx (10.04; LTS).

See here for details.


To obtain the latest R packages, add an entry like

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


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


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

in your /etc/apt/sources.list file, replacing by the actual URL of your favorite CRAN mirror. See here for the list of CRAN mirrors. To install the complete R system, use

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

Users who need to compile R packages from source [e.g. package maintainers, or anyone installing packages with install.packages()] should also install the r-base-dev package (Not relevant to you, added for clarity):

  sudo apt-get install r-base-dev
share|improve this answer
Well, according to your source, it looks like someone in R development team don't want us to install R from Ubuntu repository. There is a package in Ubuntu repository: r-base. –  user280493 Aug 4 '14 at 7:20
If you want to download R and install it, then you have to get funky about adding the public key of the R package server like this answer: askubuntu.com/questions/503270/… –  karel Aug 4 '14 at 7:25
If you don't add the public key then you can't install R. The terminal will, however, give you a message asking you to add the public key before you install R and if you add the public key then r-base can be installed successfully afterwards. –  karel Aug 4 '14 at 7:35
All the information that you need to add the public key is detailed in the link given in my first comment. I can also confirm that the information in the linked answer is current and it works for installing the r-base package in Ubuntu 14.04. –  karel Aug 4 '14 at 7:40
Okay then :-) Thanks! –  Tim Aug 4 '14 at 7:41

OK to install with sudo apt-get install r-base. BUT I would strongly recommend to install from a package manager, as R comes up with a lots of related packages.

I used Synaptics (Ubuntu 14.10):

  1. Open Synaptic package manager (or your equivalent package manager).
  2. Search r-base.
  3. If it appears, then select for Install. several other relevant package will be installed at the same time (r-base-dev etc...).
  4. If r-base does not appear, then you will have to add it to the sources list (see instructions earlier on: echo 'deb http://your-cran-mirror/bin/linux/ubuntu trusty/' | sudo tee -a /etc/apt/sources.list.d/r.list).
share|improve this answer
Running sudo apt-get install r-base is a way of installing R with a package manager. It should be expected to have the same effect as steps 1 through 3 using Synaptic. apt-get also resolves dependencies, automatically downloading and installing whatever other available packages are required or recommended. –  Eliah Kagan May 10 at 23:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.