linux安装 R编译器,CentOS 下 R 的安装

相比Windows下的安装,Linux操作系统中可以使用源代码安装,由于相关组件的依赖性,所以安装起来会麻烦点, 但由于网络上资料甚多,因此也不太复杂。

一、R语言环境的安装

1.下载R的源码,可以在,获取最新版的R代码,写文档的时候,版本为R-3.3.0

wget

2.解压

Cd /usr/

tar -zxvf R-3.3.0.tar.gz

cd R-3.3.0

3.安装一些依赖包和配置

sudo yum install readline-devel

sudo yum install libXt-devel

./configure--enable-R-shlib --prefix=/usr/ R-3.3.0 --with-readline=yes --with-libpng=yes

在实际过程中,由于CentOS环境不同, 还需安装其它一些包,否则configure会出现一系列报错, 当出现问题时, 执行相应命令后,可再执行上面的configure命令例如:

⑴当出现:

configure: error: C++ preprocessor“/lib/cpp”sanity check

check See `config.log’for more details

这可能是由于c++编译器的相关package没有安装,执行:

sudo yum install glibc-headers gcc-c++

如果不放心,也可加上:

sudo yum install build-essential

⑵当出现:

configure: WARNING: you cannot build PDF versions of the R manuals

configure: WARNING: you cannot build PDF versions of vignettes and help pages

configure: WARNING: you cannot build info or HTML versions of the R manuals

可执行:

sudoyuminstall texinfo

sudoyum install texlive

⑶当出现:

configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally

configure: error: bzip2 library and headers are required

可执行:

sudo yuminstall bzip2-devel

sudo yuminstall bzip2-libs

⑷当出现

WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally

执行:

wget

解压 :Unzip inconsolata.zip

将文件拷贝到目录下:

cp -Rfp inconsolata/* /usr/share/texmf/

刷新sty:

Mktexlsr

⑸当出现:

configure: error: "liblzma library and headers are required"

执行:

sudo yum -y install xz-devel.x86_64

⑹当出现:

configure: error: pcre >= 8.10 library and headers are required

执行:

sudo yum install pcre-devel.x86_64pcre-static.x86_64 pcre-tools.x86_64 pcre.x86_64

⑺当出现:

configure: error: libcurl >= 7.28.0 library and headers are required with support for https

执行:

sudo yum installlibcurl-devel.x86_64 libcurl.x86_64

⑻以下是我没遇到但其它材料提到的:

# sudo yum install gcc-gfortran#否则报”configure: error: No F77 compiler found”错误

# sudo yum install gcc gcc-c++#否则报”configure: error: C++ preprocessor“/lib/cpp”fails sanity check”错误

# sudo yum install readline-devel#否则报”–with-readline=yes (default) and headers/libs are not available”错误

# sudo yum install libXt-devel#否则报”configure: error:–with-x=yes (default) and X11 headers/libs are not available”错误

4.编译和安装

make

make install

在make过程中,如果出现Unable to compile a JNI program, 忽略,目前还没遇到问题

5环境配置

为了能在任何环境下执行R ,有两种方法,一是

vi .bash_profile

PATH=/usr/R-3.0.1/bin

二是ln -s /usr/R-3.3.0/bin/R /usr/local/bin/R

6 .测试

输入R看是否可以出现命令行窗口

二、 配置R Studio Server

1.安装

$ wget

$ sudo yum install --nogpgcheck rstudio-server-rhel-0.99.903-x86_64.rpm

在本地执行:看是否可以出现登录界面, 可以使用linux中自定义的用户来登录

2.开启防火墙

$ sudo firewall-cmd --zone=public --add-port=8787/tcp --permanent

$ sudo firewall-cmd –reload

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值