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 the table of platform requirements in Oracle R Enterprise System Requirements. 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 Linux Yum Server.

3.2.1 Installing Oracle R Distribution on Oracle Linux Using Yum

Oracle recommends using 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, 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 the version number to install for Rversion. For example, to install R-3.3.0, use the command yum install R-3.3.0.

    # 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 the table of configuration requirements and server support in Oracle R Enterprise System Requirements to determine which version of R you should use.

  5. On Linux 6, install the R-core-extra RPM:

    yum install R-core-extra
    
  6. On Linux 6, set the LD_LIBRARY_PATH environment variable to the location of the R-core-extra RPM.

    For example, the default location of the R-core-extra RPM is /usr/lib64/R/port/Linux-X64/lib. The following command sets LD_LIBRARY_PATH to the default location:

    export LD_LIBRARY_PATH=/usr/lib64/R/port/Linux-X64/lib
    

    On Linux 7, the required versions of these libraries are available natively so setting LD_LIBRARY_PATH is not required.

About the R-core-extra RPM

R has always depended on several third party libraries, specifically, zlib, bzip2, xz, pcre, and curl. Prior to R-3.3.0, R depended on much older versions of these libraries, but, if they were not found on the system, bundled copies were included that were built on the fly.

R-3.3.0 depends on much newer versions of these libraries and no longer contains the bundled copies. This means that R 3.3.0 won't build against Linux 6 as is, because the native versions of these libraries are older than those that R-3.3.0 requires.

The R-core-extra RPM contains the required versions of these libraries and is provided as a convenience for users of Oracle Linux 6. Adding the location of the libraries in R-core-extra to LD_LIBRARY_PATH removes the need to built these libraries separately. Oracle Linux 7 introduces the required versions of these libraries, but the R-core-extra RPM is provided as a convenience if needed.

Example 3-1 Oracle R Distribution RPMs in addons Repository

In the following URLs, Rversion represents the version of Oracle R Distribution. For example, replace Rversion with 3.3.0-1 for R 3.3.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-core-extra-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-core-extra-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 due to lack of internet access, 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

3.2.2.1 Oracle R Distribution 3.3.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.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-3.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-core-extra-3.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/R-devel-3.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-3.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-devel-3.3.0-2.el7.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL7/addons/x86_64/getPackage/libRmath-static-3.3.0-2.el7.x86_64.rpm

3.2.2.2 Oracle R Distribution 3.3.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.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-core-3.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-core-extra-3.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/R-devel-3.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-3.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-devel-3.3.0-2.el6.x86_64.rpm
http://public-yum.oracle.com/repo/OracleLinux/OL6/addons/x86_64/getPackage/libRmath-static-3.3.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 the R version you want to build. For example, replace Rversion with rpm -i /refresh/home/rpmbuild/RPMS/x86_64/R-core-3.3.0-2.el6.x86_64.rpm for R-3.3.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. From Oracle public yum, download the source RPM (Rversion.elx.src.rpm where x is the Oracle Linux version you are using).

    For Red Hat Enterprise Linux 6:

    Oracle Linux 6 (x86_64) Addons

    Save the source RPM to the rpmbuild/SRPMS directory.

  4. Rebuild Red Hat Enterprise Linux using rpmbuild.

    rpmbuild --rebuild /rpmbuild/SRPMS/R-Rversion.elx.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.elx.x86_64.rpm 
    # rpm -i path/rpmbuild/RPMS/R-core-Rversion.elx.x86_64.rpm 
    # rpm -i path/rpmbuild/RPMS/libRmath-Rversion.elx.x86_64.rpm 
    # rpm -i path/rpmbuild/RPMS/libRmath-devel-Rversion.elx.x86_64.rpm 
    # rpm -i path/rpmbuild/RPMS/libRmath-static-Rversion.elx.x86_64.rpm 
    # rpm -i path/rpmbuild/RPMS/R-devel-Rversion.elx.x86_64.rpm
    

    For example, this command installs R 3.3.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.3.0-2.el6.x86_64.rpm