CentOS 下安装R和Rstudio

方法一:yum安装R

在centos 7下安装R软件可以使用两种方式:源码编译安装和Yum在线安装。而R的官网上已经说明了,R已经被EPEL仓库管理着,EPEL是一个汇集了各种附加软件包的项目,所以我们使用yum来安装

1 通过如下命令安装并启用 EPEL (如果已经安装过,直接执行第二步)
yum install epel-release

2 使用如下命令安装R
yum install R

3 安装完成之后,直接在终端输入R然后回车之后出现类似如下内容则表示安装成功
[root@localhost ~]# R

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 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.

>
#安装成功

 

 

方法二:源码安装R

#第一步:安装依赖包:

yum install -y gcc gcc-c++
yum install -y gcc-gfortran
yum install -y readline-devel
yum install -y install bzip2-devel
yum install -y libXt-devel
yum install -y fonts-chinese tcl tcl-devel tclx tk tk-devel
yum install -y mesa-libGLU mesa-libGLU-devel
yum install -y install libcurl
yum install -y install libcurl-devel
yum -y install xz-devel.x86_64



#第二步:下载R源码解压、安装

#我下载的版本为R-3.5.2.tar.gz
#解压:tar xvf R-3.5.2.tar.gz
我的解压在:/opt/R-3.5.2
cd /opt/R-3.5.2
mkdir /opt/R
./configure --prefix=/opt/R --enable-R-shlib
make
make install
#如果到这没有发生错误,说明R已经安装好。。然后配置R的环境变量


#如果configure编译错误:configure: error: libcurl >= 7.22.0 library and headers are required with support for https
解决方法:
wget https://curl.haxx.se/download/curl-7.47.1.tar.gz
./configure --prefix=/software/packages
make -j3
make install
重要:在系统路径path中声明:curl的bin路径
vi /etc/profile
export PATH=$PATH:/opt/curl/bin
编译错误及解决方案:

2、问题描述:configure: error: “liblzma library and headers are required”
解决方法:yum -y install xz-devel.x86_64

configure: error: pcre >= 8.20 library and headers are required
解决方案:pcre版本过低,安装pcre-8.41.tar.gz
wget http://ftp.exim.llorien.org/pcre/pcre-8.41.tar.gz
tar -zxvf pcre-8.39.tar.gz
cd pcre-8.39
./configure
make
make install


第三步、设置环境变量

vim /etc/profile
R_HOME=/opt/R
PATH=$PATH:$R_HOME/bin
source /etc/profile
#如果profile没有可执行权限,可以使用以下命令增加可执行权限
#chmod +x /etc/profile

 

安装Rstudio

#依赖包

yum -y install psmisc.x86_64


#需要安装一个RStudio(Server)版,直接进入官网https://www.rstudio.com/products/rstudio/download-server/ 找到自己系统对应的版本

#安装Rstudio(Server)
https://www.rstudio.com/products/rstudio/download-server/
#我的操作系统是Centos7 按照官网提示的安装命令进行安装
$ wget https://download2.rstudio.org/rstudio-server-rhel-1.1.456-x86_64.rpm
$ rpm -ivh rstudio-server-rhel-1.1.456-x86_64.rpm
#使用浏览器访问ip+8787进入rstudio安装完成后你就可以访问了
http://yourIP:8787
#yourIP改成你服务器的地址(用ifconfig命令就可以知道自己当前服务器ip)
#比如
http://192.168.0.186:8787
#默认的port是8787
#然后输入当前系统用户名密码即可登录

 

感谢:https://blog.csdn.net/jack_nichao/article/details/76559945

https://www.cnblogs.com/Yiutto/p/5958523.html

你可能感兴趣的:(大数据处理技术)