Installing R and Rstudio on Linux CentOS 7

Installing R and Rstudio on Linux CentOS 7

Introduction

This Article describes how to install R on a Linux system. Installation of R on a Linux server is bit complicated when compared to a Windows install. There are a large number of Linux libraries that need to be installed as prerequisites, and these have been documented in this article. Since R is a  freeware, information available online is very scattered and incomplete. This document attempts at gather all information obtained by performing multiple proofs of concepts.

Prerequisites

It is recommended to use a 64-bit Operating system to retain the flexibility of allowing backward compatibility in case both a 64 bit and a  32 bit R install are needed on the same server. Also, it is best to utilize the Linux repository that houses 64 bit Linux OS packages.

 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.
*CRAN is an official website that maintains R sources for Linux, Windows as well as Mac platforms. In addition to the latest validated R sources, R add-on packages and R sources under development (R-devel v-x.xx) can be found on CRAN.
** rpm packages are those packages that are not available in the Linux repository; these have to be downloaded separately and then copied onto the Linux server and installed. It should be ensured that the rpm
package has the same bit structure as the Linux Operating System – 64 bit in this case.

Packages required for installation:

  1. fontconfig-devel: fontconfig is a library designed to provide system-wide font configuration, customization and application access.
  2. libtiff : libtiff supports a wide variety of storage and data compression schemes that can be used to optimize retrieval time and
    minimize storage space.
  3. Libtiff-devel: This is the development version of libtiff.
  4. pango-devel : Pango is a library for laying out and rendering of text, with an emphasis on internationalization.
  5. cairo : Cairo is a 2D graphics library with support for multiple output devices. Cairo is designed to produce consistent output on all output media while taking advantage of display hardware acceleration when available.
  6. texlive-latex : Texlive provides support for all the major TeX-related programs, macro packages, and fonts that are free software, including support for many languages around the world.
  7. libRmath rpm libRmath is a standalone library of mathematical and statistical functions derived from the R project. This package
    provides the static libRmath library and header files.
  8. readline-devel : The reading module can be used to enhance interactive command line programs to make
    them easier to use. It is primarily used to provide command line text completion, or “tab completion”.
  9. libXt-devel: libXt library provides functions for interacting with the X11 server. This mainly serves to exploit the graphic capabilities of R.
  10. firefox: Standard Browser Support.
  11. tcl-devel: The tcl library contains header files and documentation needed for writing Tcl extensions in compiled languages like C, C++, etc.
  12. tk-devel: The tk library contains header files and documentation needed for writing Tk
    extensions in compiled languages like C, C++, etc., or for embedding Tk in program
  13. bzip2-devel : Core R Support.
  14. pcre-devel : The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5.
  15. libxml2-devel : The libxml library als to manipulate XML files. It includes support to read, modify and write XML and HTML files.
  16. Java-OpenJDK-devel : Java 6 SDK is a development environment for building applications, applets, and components using the Java programming language.
  17. boost-devel : provides for free portable C++ source libraries. which is a pre requisite for R Studio.
  18. openssl-devel : OpenSSL is a toolkit for supporting cryptography. The OpenSSL-devel package contains include files needed to develop applications which support various cryptographic algorithms and protocols.
  19. openmpi-devel : openmpi provides support for a standard message passing interface.
  20. gtk2-devel : gtk is a multi-platform toolkit for creating graphical user interfaces, ly useful for
    displaying quality graphics in R.
  21. *texinfo build from source Texinfo can be utilized for generating standard manuals along with a printable version using just onesource file. Therefore it is helpful in generating a pdf support file in the end of an R install.
  22. libjpeg-turbo rpm ibjpeg-turbo is a JPEG image codec that provides features to accelerate baseline JPEG compression and decompression, which is useful for saving R graphical output in standard jpeg format.
  23. *proj build R studio support. Standard pre requisite for R add on package
    rgdal.

Installing R in Centos 7 x64

Step:1 Open the Shell / Terminal in CentOS.

Step:2 Login as root user and type following command.

[root@localhost vivek]#  yum -y install R

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

R x86_64 3.3.1-2.el7 epel 26 k

Installing for dependencies:

R-core x86_64 3.3.1-2.el7 epel 51 M

R-core-devel x86_64 3.3.1-2.el7 epel 100 k

R-devel x86_64 3.3.1-2.el7 epel 25 k

Transaction Summary

Starting R in Shell

Just type R in Shell as follows to start

[root@localhost vivek]# R

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"

Copyright (C) 2016 The R Foundation for Statistical Computing

Platform: x86_64-redhat-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.

You are welcome to redistribute it under certain conditions.

Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.

Type 'contributors()' for more information and

'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or

'help.start()' for an HTML browser interface to help.

Type 'q()' to quit R.

>

 

Installing RStudio on CentOS

First, you need to download the rstudio package from www.rstudio.com.

To download via UNIX type the following command.

[root@localhost vivek]# wget https://download1.rstudio.org/rstudio-1.0.44-x86_64.rpm

[root@localhost vivek]# rpm -ivh rstudio-1.0.44-x86_64.rpm

Preparing... ################################# [100%]

Updating / installing...

1:rstudio-1.0.44-1 ################################# [100%]

 

Download Rstudio
Download link for rstudio

 

How to start Rstudio in Linux

Just type the following command in shell.

[root@localhost vivek]# rstudio
Rstudio for R programming
RStudio

 

Filed in: R

Share this post

Leave a Reply