Linux system-How to install R in CentOS7.2

Source: Internet
Author: User
Tags readline gfortran

use Ubuntu's small partners to directly use the command sudo apt-get install r-base-dev or r-base . However, for the use of CentOS I have been stuck in the installation of this step, very sad, only the envy of the part, but also not on Linux on the use of R. method or some, I summed up two ways, if there is a problem, please give more advice.

Method One: Compile R's source code

I remember looking for a long time on the R official website did not find can install Yum or RPM package. Find to find out only one source, and then on the silly wget down, unzip the compilation, and then God bless, installation success. Here's how:

1 , the various packages required before installation ( Some words can be omitted ) :

Yum Install gcc gcc-c++

Yum Install Gcc-gfortran

Yum Install Readline-devel

Yum Install Libxt-devel

Yum install Fonts-chinese tcl tcl-devel tclx tk tk-devel

Yum install Mesa-libglu mesa-libglu-devel (otherwise it won't fit the artifact . Rgl , of course, not the classmate can not pretend)
R Installation:
2. Download r-3.2.3.tar.gz to Desktop,CD switch to Desktop directory:

unzip: tar-xzvf r-3.2.3.tar.gz, get r-3.2.3
in /opt r , su root switch to root user execution mkdir/opt/r   

Configuration ( It is important to specify the installation directory for uninstallation, as well as to generate a dynamic link library. ) : ./configure--enable-r-shlib=yes--with-libpng-x=no--with-tcltk--prefix=/opt/r

Compile: Make

Installation: Make Install

Configure the Environment: To Open the configuration environment file: Vi/etc/profile , add below the last line:
R_home=/opt/r
Path= $PATH: R_home/bin

to uninstall: just delete /opt/r can be modified at the same time Vi/etc/profile in the file R environmental information;

3. Troubleshooting Installation Errors

① error message: "configure:error:No F77 compiler found" , perform Yum Install Gcc-gfortran can be resolved;

② error message: "--with-readline=yes (default) and Headers/libs is not available" , perform Yum Install Readline-devel can be resolved;

③ error message: "–with-x=yes (default) and X11 Headers/libs is not available" , perform Yum Install Libxt-devel can be resolved

method two: use source installation Span style= "Font-family:times New Roman;" >r

In addition to compiling r r epel YUM source to install Span style= "Font-family:tahoma;" >r :
Span style= "font-family: the song Body;" > First step: Install epel-release
Yum install  epel-release
Step two: Modify the source configuration file /etc/yum.repos.d/epel.repo, The base recovery, the address of the mirror is commented out, using the command
Vim/etc/yum.repos.d/epel.repo, Enter insert mode to put all

#baseurl
Mirrorlist

Change into

BaseURL

#mirrorlist (centos7 This step can be saved)
 
step three: Install r
Yum Install R
Fourth step: Install the test after the termimal r carriage return, r successful start
 
Fifth step: test code, cool one

x <-C (1,2,5,7,9)
Y <-C (2,4,7,8,10)
Plot (x, y)
Abline (LM (Y~X))
Title (" regression image ")

Ps:linux under the installation of r than in Windows more complex, mainly pre-compiler a large pile, some articles on the Internet are also written on each of them, touched me a lot of wall
There are 2 ways to write on the internet, but it's a bit problematic for different operating systems and different R versions.

My operating system is CENTOS-7-X86_64-DVD-1511,R version R-3.3.1, try the first method will fail!
Then try the 2nd method and succeed (the second step of method two can be skipped)

Linux system-How to install R in CentOS7.2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.