Centos7 配置R环境

  1. 安装java并配置环境变量

    [root@node01 ~]# java -version
    java version "1.8.0_162"
    Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
    
  2. 安装编译器

    sudo yum -y install gcc
    sudo yum -y install gcc-c++
    sudo yum -y install gcc-gfortran
    
  3. 安装依赖包

    sudo yum -y install readline-devel
    sudo yum -y install libXt-devel
    sudo yum -y install bzip2-devel
    sudo yum -y install xz-devel.x86_64
    sudo yum -y install libcurl-devel
    sudo yum -y install texinfo.x86_64 texlive-pdftex-doc.noarch tex texlive-scheme-basic
    
  4. 下载R源码
    wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.4.2.tar.gz

    [root@node01 ~]# wget https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.4.2.tar.gz
    --2019-03-06 13:16:00--  https://mirrors.tuna.tsinghua.edu.cn/CRAN/src/base/R-3/R-3.4.2.tar.gz
    Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
    Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 30255544 (29M) [application/x-gzip]
    Saving to: ‘R-3.4.2.tar.gz’
    
    100%[===================================================================================================================================================>] 30,255,544  8.72MB/s   in 3.3s   
    
    2019-03-06 13:16:07 (8.72 MB/s) - ‘R-3.4.2.tar.gz’ saved [30255544/30255544]
    
    
  5. 解压R源码包

    [root@node01 ~]# tar -zxvf R-3.4.2.tar.gz 
    
  6. 执行命令进行配置

    [root@node01 ~]# cd R-3.4.2/
    [root@node01 R-3.4.2]# sudo ./configure --prefix=/usr/local/R-3.4.2 --enable-R-shlib
    

    在这里插入图片描述

  7. 配置成功后,执行如下命令进行编译并安装

    [root@node01 R-3.4.2]# sudo make && make install
    

    在这里插入图片描述

  8. 配置R环境变量

    [root@node01 ~]# cd /etc/profile.d
    [root@node01 profile.d]# vim r.sh
    [root@node01 profile.d]# cat r.sh 
    export R_HOME=/usr/local/R-3.4.2
    export PATH=$PATH:$R_HOME/bin
    
  9. 使环境变量立即生效,并验证环境变量是否配置成功
    source /etc/profile

    [root@node01 ~]# R
    -bash: R: command not found
    [root@node01 ~]# source /etc/profile
    [root@node01 ~]# R
    
    R version 3.4.2 (2017-09-28) -- "Short Summer"
    Copyright (C) 2017 The R Foundation for Statistical Computing
    Platform: x86_64-pc-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.
    
    > q()
    Save workspace image? [y/n/c]: n
    

10.R代码测试
–待续

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值