R环境离线部署

一、R安装

1、依赖包安装

yum install gcc gcc-c++ -y
yum install gcc-gfortran -y
yum install readline-devel -y
yum install libXt-devel -y
yum install fonts-chinese tcl tcl-devel tclx tk tk-devel -y
yum install mesa-libGLU mesa-libGLU-devel -y
yum -y install bzip2-devel 
yum -y install zlib*
yum install -y cairo-devel
yum install libpng libpng-devel libtiff libtiff-devel libjpeg-turbo libjpeg-turbo-devel -y

2、R编译安装

下载地址http://ftp.iitm.ac.in/cran/src/base/R-3/R-3.2.2.tar.gz

上传到服务器,解压,并进入目录,执行如下命令编译安装

./configure --enable-R-shlib=yes --with-libpng-x=yes --with-tcltk --with-libtiff --with-x --prefix=/usr/local/R
make clean
make
make install

3、配置

修改/etc/bashrc,增加如下配置
R_HOME=/opt/R
PATH=$PATH: $R_HOME/bin

二、R package安装

依赖的源package下载地址:https://cran.r-project.org/src/contrib/

1、通用安装方法

需要安装哪个包就下载哪个,然后在命令行执行如下即可安装

R CMD INSTALL package.tar.gz

2、安装时间序列包

需要安装tseries和forecast包,但是包之间互相依赖,最终需要安装如下包

R CMD INSTALL zoo_1.8-0.tar.gz 
R CMD INSTALL quadprog_1.5-5.tar.gz 
R CMD INSTALL tseries_0.10-40.tar.gz 
R CMD INSTALL forecast_8.0.tar.gz 
R CMD INSTALL fracdiff_1.4-2.tar.gz 
R CMD INSTALL Rcpp_0.12.11.tar.gz 
R CMD INSTALL colorspace_1.3-2.tar.gz 
R CMD INSTALL digest_0.6.12.tar.gz 
R CMD INSTALL gtable_0.2.0.tar.gz 
R CMD INSTALL plyr_1.8.4.tar.gz 
R CMD INSTALL stringi_1.1.5.tar.gz 
R unzip stringi-master.zip
R CMD INSTALL stringi-master
R CMD INSTALL stringr_1.2.0.tar.gz
R CMD INSTALL reshape2_1.4.2.tar.gz
R CMD INSTALL RColorBrewer_1.1-2.tar.gz 
R CMD INSTALL dichromat_2.0-0.tar.gz 
R CMD INSTALL munsell_0.4.3.tar.gz 
R CMD INSTALL labeling_0.3.tar.gz 
R CMD INSTALL scales_0.4.1.tar.gz 
R CMD INSTALL assertthat_0.2.0.tar.gz 
R CMD INSTALL rlang_0.1.1.tar.gz 
R CMD INSTALL tibble_1.3.1.tar.gz 
R CMD INSTALL lazyeval_0.2.0.tar.gz 
R CMD INSTALL ggplot2_2.2.1.tar.gz
R CMD INSTALL magrittr_1.5.tar.gz 
R CMD INSTALL lmtest_0.9-35.tar.gz 
R CMD INSTALL timeDate_3012.100.tar.gz 
R CMD INSTALL RcppArmadillo_0.6.400.2.2.tar.gz 
R CMD INSTALL forecast_8.0.tar.gz

三、RStudioServer安装

下载地址:https://download2.rstudio.org/rstudio-server-rhel-0.99.484-x86_64.rpm

1、安装

rpm  -ivh  rstudio-server-rhel-0.99.484-x86_64.rpm

2、配置

修改/etc/rstudio/rserver.conf,设置如下属性
rsession-which-r=/usr/local/bin/R

3、启动

rstudio-server start 

http://localhost:8787 用户/密码同linux用户密码

 

 

 

 

你可能感兴趣的:(开发语言,开发工具,R,rstudio)