how to install_and_configure_r_on_a_linux_server

6
How to Install and Configure R on a Linux Server 08/12/2014 EIM MDM Services Vikrant Singh Bisht R/SAS Analytics [email protected]

Upload: sushantbit04

Post on 16-Jul-2015

67 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to install_and_configure_r_on_a_linux_server

How to Install and Configure R on a Linux Server

08/12/2014

EIM MDM Services

Vikrant Singh Bisht

R/SAS Analytics

[email protected]

Page 2: How to install_and_configure_r_on_a_linux_server

Table of Content

1. Introduction.................................................................................................................................................. 3

2. Pre requisites ................................................................................................................................................ 3

3. Setting up and Installing Linux system level libraries (Also referred to as OS level libraries)................................ 3

4. Installing R .................................................................................................................................................... 4

5. Post Installation Verification .......................................................................................................................... 5

6. Conclusion .................................................................................................................................................... 5

Page 3: How to install_and_configure_r_on_a_linux_server

1. Introduction This Document describes how to install R on a Linux system. The list of pre requisite Linux libraries needed has also

been documented. Since R is a freeware, information available online is very scattered and incomplete. This

document attempts at collating all information obtained by performing multiple proof of concepts.

2. Pre requisites

As a pre requisite, the user performing the install should have the ability to sudo into the server as root. In other

words root access is a must to perform the install.

The Linux Operating System used for establishing all proof of concepts was Red Hat 6.3 (Santiago) , it is

recommended to use a 64 bit Operating system to retain the flexibility of allowing reverse compatibility in case a 32

bit R install is needed on the same server. The Linux repository used was as6-u3_64.

The R source files were downloaded from CRAN - http://cran.r-project.org.The source rpm’s can be downloaded

from trusted Linux ftp sites such as ftp://ftp.remotesensing.org or http://www.rpmfind.net .

3. Setting up and Installing Linux system level libraries (Also referred to as OS level libraries)

The OS level libraries that need to be installed prior to installing R fall under two categories. The first category

includes those libraries that can be installed from the local Linux repository using the yum command and the second

one includes packages downloaded from trusted internet websites that can be installed using the rpm command. The table below describes the order in which these libraries need to be installed.

Index Library Name Type of install

(yum/rpm)

Purpose Criticality

1. fontconfig-devel yum Native text support. HIGH

2. libtiff yum Support for .tiff files. HIGH

3. Libtiff-devel yum Support for .tiff files. HIGH

4. pango-devel yum Header library support. HIGH

5. cairo yum X11 library support. HIGH

6. texlive-latex yum PDF Support. HIGH

7. libRmath rpm N/A HIGH

8. readline-devel yum GNU readline Support. HIGH

9. libXt-devel yum N/A HIGH

10. firefox yum Standard Browser Support. HIGH

11. tcl-devel yum N/A HIGH

12. tk-devel yum N/A HIGH

13. bzip2-devel yum Core R Support. HIGH

14. pcre-devel yum N/A HIGH

15. libxml2-devel yum XML support. HIGH

16. java-openjdk- yum HIGH

Page 4: How to install_and_configure_r_on_a_linux_server

devel

Standard JAVA support.

17. boost-devel yum Pre requisite for R studio. MEDIUM

18. openssl-devel yum Support for SSL connections.

HIGH

19. openmpi-devel yum Support for MPI connections.

HIGH

20. gtk2-devel yum Graphics Support. MEDIUM

21. *texinfo build from source

Native characterset support. HIGH

22. libjpeg-turbo rpm Standard JPEG file Support. HIGH

23. R-core rpm R studio support. LOW

24. *gdal rpm Standard pre requisite for R add on package rgdal.

LOW

25. *proj build from source

Standard pre requisite for R add on package rgdal.

LOW

26. *geos build from source

Standard pre requisite for R add on package rgeos.

LOW

27. jags rpm Standard pre requisite for R add on package rjags.

LOW

28. jags3-devel rpm Standard pre requisite for R add on package rjags.

LOW

*NOTE – These libraries need to be configured and build using the configure and make commands respectively. However, this may vary depending upon the source rpm. It is recommended to build the rpm’s with default settings

so as to ensure that the OS is able to locate the configuration without any issues.

It is very important to update the bash_profile located at the root home after every install with the location of

the installed library (separated by a colon). This will help in resolving inter dependency between libraries since

the bash_profile is the automatic lookup file from where all installation paths are fetched.

The special inconsolata fix should be updated in the bash_profile since it is essential to ensure pdf support. Once

all installation paths have been updated in the bash_profile, add the following:-

R_RD4PDF = times:inconsolata

Export R_RD4PDF

4. Installing R

4.1 Downloading the R source tar file – The R source tar file can be downloaded from the CRAN website

(http://cran.r-project.org/) which is the standard website for downloading R.

4.2 Once the source has been downloaded onto the Linux machine, the following steps can be used to extract, configure and install R :-

4.2.1 Downloading and extracting the source

Navigate to the folder containing the tar file. Example cd /usr/local/R

Page 5: How to install_and_configure_r_on_a_linux_server

Untar the source using the tar –xvf command (if the source file has the extension .gz as well then a

gunzip will need to be done prior to this step as well.

4.2.2 Compiling, building and installation.

Navigate to within the created by the above two steps. Example cd /usr/local/R/R-3.1.2.

Configure the R software by issuing the configure command with the accompanying options. If all

the pre requisite libraries marked with HIGH criticality earlier installed successfully, then the

following configure command can be used :-

./configure --prefix=/usr/local/R/R-3.1.2 --with-cairo=yes --enable-R-shlib --with-tcltk --with-

x=yes --with-libpng=yes --with-jpeglib=yes

This ensures that all the capabilities are installed and available, if it is explicitly required not to

include some functionality, then the corresponding flag can be unset by replacing the ye s with a no.

Next, from the same location (/usr/local/R/R-3.1.2), execute the make command. This does not

need any parameters and will run for approximately 20 minutes building up internal libraries for all

configure parameters.

Next run the command make install – this command will do the R install based on the configure

and build steps earlier.

Next the make install-info command can be run- this is optional but helpful in summarising the

install.

The final command to be run is make install-pdf. This command is used to setup pdf support.

5. Post Installation Verification

Logout as an administrator and re login as a normal end user.

Type R at the command prompt – If R is installed exactly per the steps earlier, no soft link creation is

necessary – in case the user experiences some issues, he/she can navigate to the lib64/R folder

within the installation directory and key in ./R to ensure the correct 64 bit version of R is launched.

At the R prompt type in sessionInfo() to verify session details.

The capabilities() command can be typed to verify the features that are enabled. Using the

sequence of steps in this manual, only profmem and aqua capabilities will be FALSE, since these

are not supported in Linux.

The demo(graphics) command can be used to test the graphic capabilities of the install.

6. Conclusion Using the above steps R can be installed in the Linux environment with full capabilities.Almost all the steps were

earlier performed UNIX administration team, but this document intends to make this possible for even a non UNIX

administrator to install and maintain R on Linux.

Page 6: How to install_and_configure_r_on_a_linux_server

Contact

For more information, contact [email protected]

About Tata Consultancy Services (TCS)

Tata Consultancy Services is an IT services, consulting and business solutions

organization that delivers real results to global business, ensuring a level of certainty no

other fi rm can match. TCS offers a consulting-led, integrated portfolio of IT and IT-

enabled infrastructure, engineering and assurance services. This i s delivered through its

unique Global Network Delivery ModelTM, recognized as the benchmark of excellence in

software development. A part of the Tata Group, India’s largest industrial conglomerate,

TCS has a global footprint and is listed on the National Stock Exchange and Bombay

Stock Exchange in India.

For more information, visit us at www.tcs.com.

IT Services

Business Solutions

Consulting

All content / information present here is the exclusive property of Tata Consultancy Services Limited (TCS). The content /

information contained here is correct at the time of publishing. No material from here may be copied, modified, reproduced, republished, uploaded, transmitted, posted or distributed in any form without prior written permission from TCS. Unauthorized use of the content / information appearing here may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties. Copyright © 2011 Tata Consultancy Services Limited

Thank You