RStudio provides pre-compiled binary installers for multiple versions of R across different operaing 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.
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.