3 Installing R for Oracle R Enterprise

This chapter explains how to install R for Oracle R Enterprise. This chapter contains these topics:

3.1 About R and Oracle R Enterprise

Oracle R Enterprise requires an installation of R on the server computer and on each client computer that interacts with the server. R is third-party, open source software. Open source R is governed by GNU General Public License (GPL) and not by Oracle licensing.

See Also:

3.1.1 About ROracle

ROracle is an open source R package that enables interaction between R and an Oracle database. ROracle is maintained and supported by Oracle.

ROracle is one of the open source supporting packages that is used by Oracle R Enterprise. The supporting packages are introduced in Client and Server Components of Oracle R Enterprise and described in Table 6-2.

3.1.2 Oracle R Distribution and Oracle R Enterprise

Oracle recommends that you use Oracle R Distribution, Oracle's free distribution of R, with Oracle R Enterprise. Oracle R Distribution offers significant advantages for Oracle R Enterprise.

Why Oracle R Distribution?

  • Oracle R Distribution simplifies the installation of R for Oracle R Enterprise.

  • Oracle R Distribution is supported by Oracle for customers of Oracle Advanced Analytics, Oracle Linux, and Oracle Big Data Appliance.

  • On Windows and Linux, Oracle R Distribution simplifies integration with the Intel Math Kernel Library (MKL). MKL greatly improves the performance of many mathematical computations in R, including highly vectorized and threaded Linear Algebra, Fast Fourier Transforms (FFT), Vector Math, and Statistics functions. (See Configuring Oracle R Distribution to Use MKL on the Client.)

  • On Oracle Solaris, Oracle R Distribution automatically uses Sun Performance Library. Like MKL for Linux and Windows, Sun Performance Library offers improved performance of many mathematical computations. Sun Performance Library is part of Oracle Solaris Studio.

3.1.3 Open Source R and Oracle R Enterprise

Although Oracle recommends that you use Oracle R Distribution whenever possible, you can use open source R with Oracle R Enterprise. If you choose to use open source R, then you must build it from source. Use the following configuration parameters:

./configure  --with-lapack --with-ICU=no --enable-R-shlib

See Also:

3.2 Installing Oracle R Distribution on Linux

You can install Oracle R Distribution on Oracle Linux and on Redhat Enterprise Linux. Before you begin the installation, verify that your Linux version is supported by Oracle R Enterprise, as described in Table 1-1. You can use this command to verify the Linux version:

# uname -r

Note:

For Oracle Linux systems that have access to the internet, Oracle recommends installing Oracle R Distribution from the Oracle public yum server at the following URL:

http://public-yum.oracle.com/

3.2.1 Installing Oracle R Distribution on Oracle Linux Using Yum

Oracle recommends that you use yum to install Oracle R Distribution.

Yum simplifies the installation of Oracle R Distribution by automatically resolving RPM dependencies. If you install the RPMs directly as shown in Installing Oracle R Distribution on Oracle Linux Using RPMs, then you must resolve dependencies manually.

To install Oracle R Distribution on Oracle Linux Using Yum:

  1. Log in to the Linux server as root and change to the /etc/yum.repos.d directory:

    # cd /etc/yum.repos.d
    
  2. List the contents of the directory to determine if the yum configuration file is present. The name of the configuration file is public-yum-xxx.repo, where xxx is ol6 for Oracle Linux 6, or ol7, for Oracle Linux 7.

    If the yum configuration file is not present, then download it from Oracle public yum by executing the wget command for your Linux platform:

    # wget http://public-yum.oracle.com/public-yum-xxx.repo
    
  3. Open public-yum-xxx.repo in a text editor and specify enabled=1 for xxx_latest and xxx_addons, where xxx indicates the version of Linux, either ol6, or ol7:

    [xxx_latest]
    enabled=1
    
    [xxx_addons]
    enabled=1
    

    Also, for Oracle Linux 7 only:

    [ol7_optional_latest]
    enabled = 1
    

    The location of the Oracle R Distribution packages is specified in xxx_addons. The location of the dependencies for the Oracle R Distribution RPMs is specified in xxx_latest. For Oracle Linux 7 only, several dependencies are in optional_latest.

    The URLs for the Oracle R Distribution RPMs in the addons repository are shown in the example at the end of this topic..

    Note:

    If you are not using the most recent version of Oracle Linux and you want to install dependent packages that are specific to your version, then you must enable the corresponding Oracle Linux repository.

    For example, to enable the Oracle Linux 6 base repository instead of the latest repository, follow these steps:

    1. Open the yum configuration file for the earlier version of Oracle Linux in an editor.

      /etc/yum.repos.d/public-yum-el6.repo
      
    2. Locate the section for Oracle Linux 6.

      [ol6_base]
      
    3. Change enabled=0 to enabled=1.

      The result looks like this:

      [ol6_base]
      name=Oracle Linux $releasever installation media copy ($basearch)
      baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/
      base/$basearch/
      gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
      gpgcheck=1
      enabled=1
      
  4. Execute the yum install command to install R. Specify 3.2.0 for Rversion.

    # yum install R-Rversion
    

    To install the most recent version of R that is available on Oracle public yum:

    # yum install R.x86_64
    

    Note:

    Do not assume that the most recent version of R on Oracle public yum is supported by your version of Oracle R Enterprise. Consult Table 1-2 to determine which version of R you should use.

Example 3-1 Oracle R Distribution RPMs in addons Repository

Rversion represents the version of Oracle R Distribution. Replace Rversion with 3.2.0-2 for R 3.2.0.

Oracle Linux 6:

http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-Rversion.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-core-Rversion.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-devel-Rversion.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-Rversion.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-devel-Rversion.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-static-Rversion.el6.x86_64.rpm

Oracle Linux 7:

http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-Rversion.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-Rversion.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-devel-Rversion.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-Rversion.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-devel-Rversion.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-static-Rversion.el7.x86_64.rpm

3.2.2 Installing Oracle R Distribution on Oracle Linux Using RPMs

Oracle recommends that you use yum to install Oracle R Distribution, because yum automatically resolves RPM dependencies. However, if yum is not available, then you can install the RPMs directly and resolve the dependencies manually.

To download and install the RPMs, log in as root and execute this command for each RPM listed in the following sections:

rpm -Uvh rpm_name

The Oracle R Distribution RPMs for R 3.2.0 are listed in these topics:

3.2.2.1 Oracle R Distribution 3.2.0 RPMs for Oracle Linux 7

The Oracle R Distribution RPMs for Oracle Linux 7 are listed as follows:

http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-3.2.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-3.2.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-devel-3.2.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-3.2.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-devel-3.2.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-static-3.2.0-2.el7.x86_64.rpm

3.2.2.2 Oracle R Distribution 3.2.0 RPMs for Oracle Linux 6

The Oracle R Distribution RPMs for Oracle Linux 6 are listed as follows:

http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-3.2.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-core-3.2.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-devel-3.2.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-3.2.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-devel-3.2.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-static-3.2.0-2.el6.x86_64.rpm

3.2.3 Installing Oracle R Distribution on Red Hat Enterprise Linux

The Oracle Linux RPMs can be installed on Red Hat Linux systems. However, if you want to rebuild the Oracle R Distribution RPMs on a Red Hat Linux system, follow these instructions.

Tip:

Rversion represents the version of Oracle R Distribution. Replace Rversion with 3.2.0-2 for R 3.2.0.

To install Oracle R Distribution on Red Hat Enterprise Linux:

  1. Create an RPM build directory structure:

    mkdir -p /rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    
  2. Set up RPM tools to use your own build tree (to avoid root):

    echo '%_topdir %(echo $HOME)/rpmbuild' > /.rpmmacros
    
  3. Download the source RPM (Rversion.el6.src.rpm) from Oracle public yum.

    For Red Hat Enterprise Linux 6:

    http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/index_src.html

    Save the source RPM to the rpmbuild/SRPMS directory.

  4. Rebuild Red Hat Enterprise Linux using rpmbuild.

    rpmbuild --rebuild /rpmbuild/SRPMS/R-Rversion.ol6.src.rpm
    

    Note:

    If any dependencies are missing, install them as root.

    The binary RPMs are built and saved under /rpmbuild/RPMS.

  5. Log in as root and execute these commands to install R:

    # rpm -i path/rpmbuild/RPMS/R-Rversion-2.el6.x86_64.rpm
    # rpm -i path/rpmbuild/RPMS/R-core-Rversion.el6.x86_64.rpm
    # rpm -i path/rpmbuild/RPMS/libRmath-Rversion.el6.x86_64.rpm
    # rpm -i path/rpmbuild/RPMS/libRmath-devel-Rversion.el6.x86_64.rpm
    # rpm -i path/rpmbuild/RPMS/libRmath-static-Rversion.el6.x86_64.rpm
    # rpm -i path/rpmbuild/RPMS/R-devel-Rversion.el6.x86_64.rpm
    

    For example, this command installs R 3.2.0 on Red Hat Enterprise Linux x86-64 version 6, where the path to rpmbuild is /refresh/home/.

    # rpm -i /refresh/home/rpmbuild/RPMS/x86_64/R-core-3.2.0.el6.x86_64.rpm
    

3.3 Installing Oracle R Distribution on Oracle Solaris

You can install Oracle R Distribution on Oracle Solaris on Intel and on SPARC platforms. Before you begin the installation, verify that your Oracle Solaris version is supported by Oracle R Enterprise, as described in Table 1-1.You can use this command to verify the version of Oracle Solaris:

uname -r

To install Oracle R Distribution on Oracle Solaris:

  1. Go to the Oracle Open Source Software Download page for Oracle R Distribution:

    https://oss.oracle.com/ORD/

  2. Download the files for your installation, where Rversion is 3.2.0.0 for R-3.2.0:

    • For x86 64-bit systems:

      ord-Rversion-sol10-x86-64-sunstudio12u3.tar.gz
      ord-Rversion-supporting-sol10-x86-64-sunstudio12u3.tar.gz
      
    • For SPARC 64-bit systems:

      ord-Rversion-sol10-sparc-64-sunstudio12u3.tar.gz
      ord-Rversion-supporting-sol10-sparc-64-sunstudio12u3.tar.gz
      
  3. Uncompress the first file, either sol110-x86-64 or sol10-sparc.

  4. Run install.sh as root to install the Solaris PKG file for Oracle R Distribution.

    # install.sh
    
  5. Uncompress the second file, either supporting-sol10-x86-64 or supporting-sol10-sparc, to a local directory such as $ORACLE_HOME/lib. Add that directory to $LD_LIBRARY_PATH.

    These tar files contain the shared libraries for libR.so:

    • libiconv.so.2

    • libncurses.so.5

    • libreadline.so.6

    • libsunperf.so

    libsunperf.so, Sun Performance Library, and its dependent shared libraries are included in Oracle Solaris Studio.

  6. Run the following command to verify that libR.so is picking up its shared library dependencies correctly from the local directory.

    # ldd -r /usr/lib/64/R/lib/libR.so
    
  7. Start R by typing R at the command prompt:

    % R
    

3.4 Installing Oracle R Distribution on IBM AIX

Before installing Oracle R Distribution, verify that your version of IBM AIX is supported by Oracle R Enterprise, as described in Table 1-1.You can use this command to verify the version of IBM AIX:

uname -r

To install Oracle R Distribution on IBM AIX:

  1. Go to the Oracle Open Source Software Download page for Oracle R Distribution:

    https://oss.oracle.com/ORD/

  2. Download the files for your installation, where Rversion is 3.2.0.0 for R-3.2.0:

    ORD.Rversion.bff.gz
    ord-supporting-aix.tar.gz
    

    For AIX 7, download the following:

    ORD.Rversion-aix-7.bff.gz
    ord-supporting-aix.tar.gz
    
  3. Uncompress and untar ord-supporting-aix.tar.gz:

    $ gunzip ord-supporting-aix.tar.gz  # get ord-supporting-aix.tar
    $ tar -xvf ord-supporting-aix.tar   # extract contents of .tar file
    $ ls ord-supporting-aix             # list of rpms
    
    bash-4.2-5.aix5.1.ppc.rpm 
    libpng-devel-1.5.9-1.aix5.1.ppc.rpm
    Cairo-1.10.0-1.aix5.2.ppc.rpm 
    pixman-0.28.2-1.aix5.1.ppc.rpm
    expat-2.0.1-3.aix5.1.ppc.rpm 
    pkg-config-0.25-2.aix5.1.ppc.rpm
    fontconfig-2.5.0-1.aix5.1.ppc.rpm 
    readline-6.2-3.aix5.1.ppc.rpm
    gettext-0.17-1.aix5.1.ppc.rpm 
    readline-devel-6.2-3.aix5.1.ppc.rpm
    glib2-2.28.6-1.aix5.1.ppc.rpm 
    texinfo-4.13a-2.aix5.1.ppc.rpm
    info-4.13a-2.aix5.1.ppc.rpm 
    xrender-0.9.1-3.aix5.2.ppc.rpm
    libiconv-1.14-1.aix5.1.ppc.rpm 
    zlib-1.2.6-1.aix5.1.ppc.rpm
    libpng-1.5.9-1.aix5.1.ppc.rpm 
    zlib-devel-1.2.6-1.aix5.1.ppc.rpm
    

    You can also download these RPMs from http://www.perzl.org/aix/.

  4. Install the RPMs as root using an rpm command:

    $ cd /download_directory/ord-supporting-aix
    $ su
    # rpm -i *.rpm
    

    To upgrade existing dependencies, use:

    # rpm -UF *.rpm
    

    If you experience conflicts with dependencies, use:

    # rpm -UF --nodeps *.rpm
    
  5. Add /opt/freeware/lib to the LIBPATH environment variable:

    • For ksh:

      $ export LIBPATH=/opt/freeware/lib:$LIBPATH
      
    • For csh:

      $ setenv LIBPATH /opt/freeware/lib:$LIBPATH
      

    Ensure that /opt/freeware/lib is before /usr/lib.

  6. Uncompress ORD-Rversion-aix.bff.gz to get ORD-Rversion-aix.bff:

    $ gunzip ORD.Rversion.bff.gz
    
  7. To install all the filesets in Oracle R Distribution, execute the installp command (with the apply option) as root:

    $ cd /download_directory
    $ su
    # installp -a -d . ORD   # install all the filesets in ORD
    

    You can also install independent filesets:

    # installp -a -d . ORD.core   # installs only ORE.core 
    # installp -a -d . ORD.devel  # installs only ORE.devel
    
  8. Add /usr/lib/R/lib to the LIBPATH environment variable:

    • For ksh:

      $ export LIBPATH=/usr/lib/R/lib:$LIBPATH
      
    • For csh:

      $ setenv LIBPATH /usr/lib/R/lib:$LIBPATH
      
  9. Run ldd to ensure that shared library dependencies were picked up correctly:

    $ ldd /usr/lib/R/bin/exec/R
    $ ldd /usr/lib/R/lib/libR.so (libiconv, libreadline)
    $ ldd /usr/lib/R/lib/libRlapack.so
    $ ldd /usr/lib/R/lib/libRblas.so
    

3.5 Installing Oracle R Distribution on Microsoft Windows

Before installing Oracle R Distribution, verify that your version of Microsoft Windows is supported by Oracle R Enterprise, as described in Table 1-1.

Follow these steps to install Oracle R Distribution on Windows:

  1. Go to the Oracle Open Source Software Download page for Oracle R Distribution:

    https://oss.oracle.com/ORD/

  2. Select R Distribution for Windows 64 bit. Save the zip file on your computer.

    ORD-Rversion-win.zip
    
  3. Unzip the file and extract the executable file.

    ORD-Rversion-win.exe
    
  4. Double-click the executable file to start the installation of Oracle R Distribution.

  5. Follow the instructions to complete the installation.

3.6 Configuring Oracle R Distribution to Use MKL on the Client

The instructions in this section explain how to configure Oracle R Distribution to use MKL on a Linux or Windows client. With this simple configuration step, Oracle R Distribution dynamically uses MKL if it is installed on your system.

3.6.1 Enabling MKL Support for Oracle R Distribution on a Linux Client

Follow these steps to enable MKL for Oracle R Distribution on a Linux Client:

  1. Install MKL. You can download MKL from the following website:

    http://software.intel.com/en-us/intel-mkl

    Note: To install MKL on your computer, you must have an MKL license.

  2. Add libmkl_rt.so, $RHOME/lib, and $ORACLE_HOME/lib to the LD_LIBRARY_PATH system environment variable. For example, in the Bash shell:

    export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:
                             /path_to/libmkl_rt.so:
                             ${RHOME}/lib:
                             ${ORACLE_HOME}/lib
    
  3. Start R and execute the Sys.BlasLapack function:

    Sys.BlasLapack()
         $vendor
         [1] "Intel Math Kernel Library (Intel MKL)"
         $nthreads
         [1] -1
    

The returned value of $vendor indicates that MKL has replaced the BLAS and LAPACK that are native to R.

The returned value of nthreads indicates the number of threads to be used by MKL. By default all available threads are used ($nthreads= -1).

3.6.1.1 Modifying the Number of Threads for MKL on Linux

You can change the number of threads to be used by MKL by editing the system environment variable MKL_NUM_THREADS. For example, the following statement in the Bash shell, causes MKL to use 3 threads:

export MKL_NUM_THREADS=3

After setting MKL_NUM_THREADS to 3, the output of Sys.BlasLapack shows a value of 3 for $nthreads.

R> Sys.BlasLapack()
     $vendor
     [1] "Intel Math Kernel Library (Intel MKL)"
     $nthreads
     [1] 3

3.6.2 Enabling MKL Support for Oracle R Distribution on a Windows Client

Follow these steps to enable MKL for Oracle R Distribution on a Windows client (64-bit):

  1. Install MKL. You can download MKL from the following website:

    http://software.intel.com/en-us/intel-mkl

    Note: To install MKL on your computer, you must have an MKL license.

  2. Add the location of libOrdBlasLoader.dll and mkl_rt.dll to the PATH system environment variable.For instructions, see.

    Note:

    In a typical installation of Oracle R Distribution, libOrdBlasLoader.dll is located in the R home directory:

    C:\Program Files\R\R-version\bin\x64
    

    In a full installation of MKL 11.1, mkl_rt.dll is located in the Intel MKL Composer XE directory:

    C:\Program Files (x86)\Intel\Composer XE 2013 SP
    
  3. Start R and execute the Sys.BlasLapack function:

    R> Sys.BlasLapack()
         $vendor
         [1] "Intel Math Kernel Library (Intel MKL)"
         $nthreads
         [1] -1
    

The returned value of $vendor indicates that MKL has replaced the BLAS and LAPACK that are native to R.

The returned value of nthreads indicates the number of threads to be used by MKL. By default all available threads are used ($nthreads= -1).

3.6.2.1 Modifying the Number of Threads for MKL on Windows

You can change the number of threads to be used by MKL by editing the system environment variable MKL_NUM_THREADS. If MKL_NUM_THREADS does not exist, then you must create it as described in:

After setting MKL_NUM_THREADS to 3, the output of Sys.BlasLapack shows a value of 3 for $nthreads.

R> Sys.BlasLapack()
     $vendor
     [1] "Intel Math Kernel Library (Intel MKL)"
     $nthreads
     [1] 3

3.7 Uninstalling Oracle R Distribution

To uninstall R, follow the instructions in the following sections:

3.7.1 Uninstalling Oracle R Distribution on Windows

Uninstall Oracle R Distribution just as you would uninstall any other Windows program, using Programs and Features in Windows Control Panel.

3.7.2 Uninstalling Oracle R Distribution on Linux

To uninstall Oracle R Distribution on Linux, log in as root and execute these commands in this order. The example uninstalls R-3.2.0. To uninstall a different version of R, replace the R version in the example with the number of the version you want to uninstall.

Example 3-2 Linux Commands for Uninstalling Oracle R Distribution

Execute the following commands as root.

For example, for R-3.2.0 the commands are:

rpm -e R-3.2.0-2.el6
rpm -e R-devel
rpm -e R-core
rpm -e libRmath-devel
rpm -e libRmath

3.7.3 Uninstalling Oracle R Distribution on Oracle Solaris

To uninstall Oracle R Distribution on Oracle Solaris, follow the instructions in the readme on the Oracle R Distribution download page on the Oracle Technology Network:

https://oss.oracle.com/ORD/

The Oracle R Distribution installation directory on Oracle Solaris includes an uninstall script. Log in as root and run the script as follows:

Example 3-3 Solaris Script for Uninstalling Oracle R Distribution

Execute this script as root:

./uninstall.sh

3.7.4 Uninstalling Oracle R Distribution on IBM AIX

To uninstall Oracle R Distribution on IBM AIX, follow the instructions in the readme on the Oracle R Distribution download page on the Oracle Technology Network:

https://oss.oracle.com/ORD/

Example 3-4 AIX Scripts for Uninstalling Oracle R Distribution

To uninstall all filesets, execute this script as root:

installp -u ORD
    

To uninstall individual filesets, specify their names:

installp -u ORD.devel
installp -u ORD.core