I want to install a version of R that is newer than the one in the Ubuntu repos, but older than the most current CRAN version. (How to install/upgrade r-base describes how to install the latest version and I want an older one).

I keep trying but nothing. I downloaded the .deb file but it asks me for a numerous dependencies. Does anyone know any other faster way?

  • 1
    The above describes how to install the latest version and i want an older version
    – vagelis
    Jul 13, 2016 at 22:26

2 Answers 2


I don't know of a "good/"easy" way to get an intermediate version of R (one between the Ubuntu repo version and the current one), but you have a few options:

  1. You will likely need to install dependencies anyway, so you could try installing from deb. If you only need the one version installed on your system, this may be the way to go. Install it using gdebi, which automatically resolves dependencies for you (first sudo apt-get install gdebi-core; then sudo gdebi packageName.deb).

  2. You can attempt to build from source, but that can be a pain. The upside is that you can have multiple versions of R installed this way by specifying a --prefix=/path/to/use in the ./configure step (see here).

    wget https://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
    tar xvf R-3.1.1.tar.gz
    cd R-3.2.2
    make && make install
  3. If you are familiar with Docker, you can get version-specific R images:

    docker pull r-base:3.2.2


    docker run -it --rm r-base:3.2.2
  • I have figured it out based on the @amc 's comment. I have EDITED the question with the code.
    – vagelis
    Jul 14, 2016 at 23:08
  • @vagelis nice! you may want to add your solution as an answer, rather than just adding it to the question.
    – amc
    Jul 14, 2016 at 23:15

The solution for me was the following script to build R from source:

wget https://cran.rstudio.com/src/base/R-3/R-3.2.2.tar.gz
tar xvf R-3.2.2.tar.gz
cd R-3.2.2
sudo apt-get install gcc
sudo apt-get install fort77
sudo apt-get install aptitude
sudo aptitude install g++
sudo aptitude install xorg-dev
sudo aptitude install libreadline-dev
sudo aptitude install gfortran
gfortran --version
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
java -version
# need to build shared library (--enable-R-shlib)
sudo ./configure --enable-R-shlib      # the --enable-R-shlib option is needed for the RStudio IDE to work
sudo make
sudo make install
R --version

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .