3 Installing R for Oracle R Enterprise

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

Note:

Instructions for installing Oracle R Distribution on Exadata are in Chapter 5.

3.1 About Oracle R Distribution and Open Source R

Oracle R Enterprise requires an installation of R on the computer that hosts Oracle R Enterprise Server and on each computer that hosts an Oracle R Enterprise client. If you intend to use both client and server components of Oracle R Enterprise directly on the server, then only one installation of R is necessary.

See Also:

3.1.1 Oracle R Distribution for Oracle R Enterprise

Oracle recommends that you use Oracle R Distribution with Oracle R Enterprise whenever possible. Oracle R Distribution offers these advantages:

  • Oracle R Distribution is compiled with the flags that are required by Oracle R Enterprise server components.

  • On Linux and Windows platforms, Oracle R Distribution integrates seamlessly with the Intel Math Kernel Library (MKL) to provide high performance mathematical computations.

  • On Solaris platforms, Oracle R Distribution automatically uses Sun Performance Library to provide high performance mathematical computations.

  • Oracle provides support for Oracle R Distribution with Oracle R Enterprise.

3.1.2 Open Source R for Oracle R Enterprise

You can use open source R with Oracle R Enterprise. Use the following R configuration parameters to build it from source:

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

See Also:

The R Installation and Administration manual for information about building R from source:

http://www.r-project.org/

3.2 Installing Oracle R Distribution on Linux

Oracle recommends that you use the Oracle public yum server for installing R on Linux. Oracle public yum is located at the following URL:

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

These topics explain how to install Oracle R Distribution on Linux systems:

3.2.1 Installing Oracle R Distribution on Oracle Linux Using Yum

Note:

Before installing Oracle R Distribution, verify that your version of Oracle Linux is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

You can use this command to verify the Linux version:

% uname -r

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 either el5, for Oracle Linux 5, or 0l6, for Oracle Linux 6.

    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-el5.repo
    

    or

    # wget http://public-yum.oracle.com/public-yum-ol6.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 el5 or ol6:

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

    The Oracle R Distribution packages reside in xxx_addons. The dependencies for the Oracle R Distribution RPMs reside in the latest Oracle Linux repository, xxx_latest.

    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 5.8 repository instead of the latest repository, follow these steps:
    1. Open the yum configuration file for Oracle Linux 5 in an editor.

      /etc/yum.repos.d/public-yum-el5.repo
      
    2. Locate the section for Oracle Linux 5, update 8.

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

      The result looks like this:

      [ol5_u8_base]
      name=Oracle Linux $releasever Update 8 installation media copy ($basearch)
      baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL5/8/
      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.

    To install R-3.0.1:

    # yum install R-3.0.1
    

    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, "Oracle R Enterprise Server Support Matrix" to determine which version of R you should use.

3.2.2 Installing Oracle R Distribution on Oracle Linux Using RPMs

Oracle recommends that you use yum to install Oracle R Distribution. However, if yum is not available, you can install Oracle R Distribution using RPMs.

Note:

Before installing Oracle R Distribution, verify that your version of Oracle Linux is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

You can use this command to verify the Linux version:

% uname -r

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

# rpm -Uvh rpm_name

The Oracle R Distribution 3.0.1 RPMs are listed in these topics:

3.2.2.1 Oracle R Distribution 3.0.1 RPMs for Oracle Linux 5

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

R-2.15.3-1.el5.x86_64.rpm
R-core-2.15.3-1.el5.x86_64.rpm
R-devel-2.15.3-1.el5.x86_64.rpm
libRmath-2.15.3-1.el5.x86_64.rpm
libRmath-devel-2.15.3-1.el5.x86_64.rpm

If the dependent RPMs for Oracle Linux 5, listed in Section 3.2.2.2, are not automatically included, then download and install them explicitly.

3.2.2.2 Oracle R Distribution 3.0.1 RPM Dependencies for Oracle Linux 5

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

atk-1.12.2-1.fc6.x86_64.rpm
avahi-0.6.16-10.el5_6.x86_64.rpm
avahi-compat-libdns_sd-0.6.16-10.el5_6.x86_64.rpm
bitstream-vera-fonts-1.10-7.noarch.rpm
bzip2-devel-1.0.3-6.el5_5.x86_64.rpm
cairo-1.2.4-5.el5.x86_64.rpm
chkfontpath-1.10.1-1.1.x86_64.rpm
cpp-4.1.2-54.el5.x86_64.rpm
cups-1.3.7-30.el5_9.3.x86_64.rpm
cups-libs-1.3.7-30.el5_9.3.x86_64.rpm
dbus-python-0.70-9.el5_4.x86_64.rpm
desktop-file-utils-0.10-7.x86_64.rpm
dialog-1.0.20051107-1.2.2.x86_64.rpm
ed-0.2-39.el5_2.x86_64.rpm
gcc-4.1.2-54.el5.x86_64.rpm
gcc-c++-4.1.2-54.el5.x86_64.rpm
gcc-gfortran-4.1.2-54.el5.x86_64.rpm
ghostscript-8.70-14.el5_8.1.x86_64.rpm
ghostscript-fonts-5.50-13.1.1.noarch.rpm
gmp-4.1.4-10.el5.x86_64.rpm
gtk2-2.10.4-29.el5.x86_64.rpm
hicolor-icon-theme-0.9-2.1.noarch.rpm
libFS-1.0.0-3.1.x86_64.rpm
libX11-1.0.3-11.el5_7.1.x86_64.rpm
libX11-devel-1.0.3-11.el5_7.1.x86_64.rpm
libXau-devel-1.0.1-3.1.x86_64.rpm
libXdmcp-devel-1.0.1-2.1.x86_64.rpm
libXfont-1.2.2-1.0.4.el5_7.x86_64.rpm
libfontenc-1.0.2-2.2.el5.x86_64.rpm
libgcc-4.1.2-54.el5.i386.rpm
libgcc-4.1.2-54.el5.x86_64.rpm
libgfortran-4.1.2-52.el5_8.1.i386.rpm
libgfortran-4.1.2-54.el5.x86_64.rpm
libstdc++-4.1.2-54.el5.i386.rpm
libstdc++-4.1.2-54.el5.x86_64.rpm
libstdc++-devel-4.1.2-54.el5.i386.rpm
libstdc++-devel-4.1.2-54.el5.x86_64.rpm
libtiff-3.8.2-18.el5_8.x86_64.rpm
mesa-libGL-6.5.1-7.11.el5_9.x86_64.rpm
mesa-libGL-devel-6.5.1-7.11.el5_9.x86_64.rpm
netpbm-10.35.58-10.el5.x86_64.rpm
netpbm-progs-10.35.58-10.el5.x86_64.rpm
pango-1.14.9-8.0.1.el5_7.3.x86_64.rpm
paps-0.6.6-20.el5.x86_64.rpm
pcre-6.6-6.el5_6.1.x86_64.rpm
pcre-devel-6.6-6.el5_6.1.x86_64.rpm
poppler-0.5.4-19.el5.x86_64.rpm
poppler-utils-0.5.4-19.el5.x86_64.rpm
tcl-8.4.13-6.el5.x86_64.rpm
tcl-devel-8.4.13-6.el5.x86_64.rpm
tetex-3.0-33.15.el5_8.1.x86_64.rpm
tetex-dvips-3.0-33.15.el5_8.1.x86_64.rpm
tetex-fonts-3.0-33.15.el5_8.1.x86_64.rpm
tetex-latex-3.0-33.15.el5_8.1.x86_64.rpm
texinfo-4.8-14.el5.x86_64.rpm
texinfo-tex-4.8-14.el5.x86_64.rpm
tk-devel-8.4.13-5.el5_1.1.x86_64.rpm
ttmkfdir-3.0.9-23.el5.x86_64.rpm
urw-fonts-2.3-6.1.1.noarch.rpm
xorg-x11-font-utils-7.1-3.x86_64.rpm
xorg-x11-proto-devel-7.1-13.el5.x86_64.rpm
xorg-x11-xfs-1.0.2-5.el5_6.1.x86_64.rpm
zlib-1.2.3-7.el5.i386.rpm
zlib-1.2.3-7.el5.x86_64.rpm
zlib-devel-1.2.3-7.el5.x86_64.rpm

3.2.2.3 Oracle R Distribution 3.0.1 RPMs for Oracle Linux 6

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

R-3.0.1-2.el6.x86_64.rpm
R-core-3.0.1-2.el6.x86_64.rpm
R-devel-3.0.1-2.el6.x86_64.rpm
libRmath-3.0.1-2.el6.x86_64.rpm
libRmath-devel-3.0.1-2.el6.x86_64.rpm

If the following dependent RPM is not automatically included, then download and install it explicitly.

texinfo-tex-4.13a-8.el6.x86_64.rpm

3.2.3 Installing Oracle R Distribution on Red Hat Enterprise Linux

Note:

Before installing Oracle R Distribution, verify that your version of Red Hat Enterprise Linux is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

You can use this command to verify the Linux version:

% uname -r

The following installation instructions are specific to Red Hat Enterprise Linux 6. For Red Hat Enterprise Linux 5, change ol6 to el5.

To install Oracle R Distribution on Red Hat Enterprise Linux 6: 

  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 login):

    % echo '%_topdir %(echo $HOME)/rpmbuild' > /.rpmmacros
    
  3. Download the source RPMs (*.src.rpm) from Oracle public yum. For Red Hat Enterprise Linux 6:

    http://public-yum.oracle.com/repo/OracleLinux/OL6/

    Save the source RPMs to the rpmbuild/SRPMS directory.

  4. Rebuild Red Hat Enterprise Linux using rpmbuild.

    % rpmbuild --rebuild /rpmbuild/SRPMS/R-3.0.1-1.el6.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 this command to install R:

    # rpm -i path/rpmbuild/RPMS/R-core_RPM
    

    For example, this command installs R 3.0.1 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.0.1-1.el6.x86_64.rpm
    

3.3 Installing Oracle R Distribution on Oracle Solaris

Note:

Before installing Oracle R Distribution, verify that your version of Oracle Solaris is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

You can use this command to verify the UNIX version:

% 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. The following are the files for R-3.0.1:

    • For x86 64-bit systems:

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

      ord-3.0.1-sol10-sparc-64-sunstudio12u3.tar.gz
      ord-3.0.1-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

Note:

Before installing Oracle R Distribution, verify that your version of IBM AIX is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

You can use this command to verify the UNIX version:

% 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. The following are the files for R-3.0.1:

    ORD.3.0.1.0.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
    $ 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-2.15.1-aix.bff.gz to get ORD-2.15.1-aix.bff:

    $ gunzip ORD.2.15.1.0.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. 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
    
  9. 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
      

3.5 Installing Oracle R Distribution on Windows

Before installing Oracle R Distribution, verify that your version of Microsoft Windows is supported by Oracle R Enterprise. Refer to Table 1-1, "Oracle R Enterprise Platform Requirements".

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. Under R 3.0.1 Downloads, select Windows 64 bit. Click R Distribution and save the zip file on your computer.

    ORE-3.0.1-win.zip
    
  3. Unzip the file and extract the executable file.

    ORE-3.0.1-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 web site:

    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:

    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.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 web site:

    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 Section 4.2.2.1, "Creating and Modifying Environment Variables on Windows".

    Note:

    In a typical installation of Oracle R Distribution 3.0.1, libOrdBlasLoader.dll is located in the R home directory:
    C:\Program Files\R\R-3.0.1\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 Section 4.2.2.1:

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