Binary and Source Versions
Versions of R can be obtained by various means, the most common of which is installing a binary version from a standard apt-get (Debian/Ubuntu) or yum (RHEL) repository. Versions installed this way are nearly always located in the
You may also have obtained a binary version of R from a vendor like Oracle, Revolution Analytics, or TIBCO. In those cases please consult the vendor’s documentation to determine the location where R is installed and update the relevant RStudio configuration files to point to it as described here.
To install additional versions of open-source R side-by-side with a version obtained from an apt-get or yum repository you will typically need to build R from source. The next section provides further details and recommendations on building from source.
Building Additional Versions from Source
Installing additional versions of R side-by-side with the system version requires building R from source but is very straightforward. 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: https://cran.rstudio.com/src/base/R-3/
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 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
Recommended Installation Directories
Open-Source RStudio Server
In the Open-Source RStudio Server, RStudio uses the version of R pointed to by the output of the
which R command. If RStudio is unable to locate R using
which R, it will fall back to scanning explicitly for the R script in the
/usr/bin directories. For more on this, see our article on using different versions of R here.
RStudio Server Pro
As of v0.99.715, RStudio Server Pro automatically scans for versions of R at the following locations:
/usr/lib/R /usr/lib64/R /usr/local/lib/R /usr/local/lib64/R /opt/local/lib/R /opt/local/lib64/R
In addition, RStudio Server scans all subdirectories of the following directories within
For example, any of the following installed versions of R will be automatically detected by RStudio Server:
/opt/R/3.1.0 /opt/R/3.2.0 /opt/local/R/3.1.0 /opt/local/R/3.2.0
If you have versions of R located at other places in the file system RStudio Server can still utilize them however you’ll need to explicitly specify their location in a configuration file. For more information, see Chapter 6: R Versions of the RStudio Server Pro Admin Guide.