R语言 Linux安装详解

R语言 Linux安装详解

1、下载
wget http://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.2.5.tar.gz

 

2、解压:
tar -zxvf R-3.2.5.tar.gz
cd R-3.2.5

 

3、安装 
yum install readline-devel
yum install libXt-devel
./configure

 

4、 配置环境并编译安装
./configure --prefix=/opt/R-3.2.5 --enable-R-shlib
make 

make install

 

5、配置环境变量并生效
vi /etc/profile
export R_HOME=/opt/R-3.2.5
export PATH=.:$R_HOME/bin:$PATH

 

# 试环境变量生效
source /etc/profile

 

6、 命令行测试

[root@ip-10-32-28-154 FTPDQ]# R
WARNING: ignoring environment value of R_HOME

R version 3.2.5 (2016-04-14) -- "Very, Very Secure Dishes"
Copyright (C) 2016 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()

 

7、安装rJava

先download rJava_0.9-8.tar.gz

install.packages('/home/liugang/rJava_0.9-8.tar.gz')

>library("rJava") 测试下是否安装成功


8、配置环境变量并生效

检查下rJava是否安装在$R_HOME/library下面了,如果没有,把/opt/R-3.2.5/lib64/R/library/rjava拷贝过来

vi /etc/profile

 LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH:$R_HOME/bin:$R_HOME/library/rJava/jri:$R_HOME/library/rJava/libs:$R_HOME/lib
export LD_LIBRARY_PATH


# 试环境变量生效
source /etc/profile

你可能感兴趣的:(R)