8.1 Install Oracle R Distribution on Linux in a Non-Default R_HOME

Beginning with Oracle R Distribution 3.3.0, the Linux RPMs can be installed to a directory other than the default Linux R_HOME, /usr/lib64/R.

The procedure in the following example installs the Oracle R Distribution 3.3.0 RPMs to a non-default location and still allows the user to invoke the previously installed version, R-3.2.0.

The example installs the RPMs into the directory /opt/R330. It installs the following RPMs:

R-3.3.0-2.el6.x86_64.rpm
R-core-3.3.0-2.el6.x86_64.rpm
R-core-extra-3.3.0-2.el6.x86_64.rpm
R-devel-3.3.0-2.el6.x86_64.rpm
libRmath-3.3.0-2.el6.x86_64.rpm  
libRmath-devel-3.3.0-2.el6.x86_64.rpm 
libRmath-static-3.3.0-2.el6.x86_64.rpm 
  1. From the directory that contains the RPMs, install the Oracle R Distribution 3.3.0 RPMs to a non-default location using the --prefix flag:

    # rpm -i *.rpm --prefix=/opt/R330

  2. Set R_HOME to the R-3.3.0 location and add $R_HOME/bin to PATH:

    # export R_HOME=/opt/R330/lib64/R

    # export PATH=$R_HOME/bin:$PATH

  3. Invoke the newly installed R-3.3.0. If you receive the following error, then add $R_HOME/port/Linux-X64/lib to LD_LIBRARY_PATH so R recognizes the correct versions of the pcre, zlib, xz, and bzip libraries:

    # R

    /opt/R330/lib64/R/bin/exec/R: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory

    # export LD_LIBRARY_PATH=$R_HOME/port/Linux-X64/lib:$LD_LIBRARY_PATH

    # R

    Oracle Distribution of R version 3.3.0  (--) -- "Supposedly Educational"
    Copyright (C)  The R Foundation for Statistical Computing
    Platform: x86_64-pc-linux-gnu (64-bit)...
    

If you still want to use the previous version of R, rename the default R executable /usr/bin/R to the old R version; for example, /usr/bin/R-3.2.0:

# mv /usr/bin/R /usr/bin/R-3.2.0

Now you can invoke R 3.2.0:

# R-3.2.0
Oracle Distribution of R version 3.2.0  (--) -- "Full of Ingredients"
Copyright (C)  The R Foundation for Statistical Computing
Platform: x86_64-unknown-linux-gnu (64-bit)...