Installing multiple versions of R on Linux


Recommended Installation 
RStudio provides pre-compiled binary installers for multiple versions of R across different operating systems. Follow these instructions.

Building Additional Versions from Source

In some cases, it may be necessary to compile R from source. For example, you may need to compile R from source if you are using a custom Linux distribution.

Installing Dependencies

First, ensure that you have the build dependencies required for R. On RedHat/CentOS you’d use this command:

$ sudo yum-builddep R

On Debian/Ubuntu systems you’d use this command:

$ sudo apt-get build-dep r-base

Configuring and Building R

Once you’ve satisfied the build dependencies, you should obtain and unarchive the source tarball for the version of R you want to install.  As an example, one mirror you can download R 3.X source from is: 

Once the source is downloaded, from within the extracted source directory, execute these commands (this example assumes you are installing R 3.2.0):

$ sudo ./configure --prefix=/opt/R/3.2.0 --enable-R-shlib
$ sudo make
$ sudo make install

Note that the --enable-R-shlib option is required in order to make the underlying R shared library available to RStudio Workbench or RStudio Server.

Using the System BLAS Libraries

You may also wish to link to the system BLAS libraries rather than use the R internal versions. For this you’d use the following configure command:

./configure --prefix=/opt/R/3.1.0 --enable-R-shlib --with-blas --with-lapack