首页 > 大数据 > 可视化 > CentOS 下 R 的安装
相比Windows 下的安装,Linux 操作系统中可以使用源代码安装,由于相关组件的依赖性,所以安装起来会麻烦点, 但由于网络上资料甚多,因此也不太复杂。
1. 下载R的源码,可以在 ,获取最新版的R 代码,写文档的时候,版本为R-3.3.0
wget
Cd /usr/
tar -zxvf R-3.3.0.tar.gz
cd R-3.3.0
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
可执行:
sudo yum install texinfo
sudo yum 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 yum install bzip2-devel
sudo yum install 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_64 pcre-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 install libcurl-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”错误
make
make install
在make 过程中,如果出现Unable to compile a JNI program , 忽略,目前还没遇到问题
为了能在任何环境下执行R ,有两种方法,一是
vi .bash_profile
PATH=/usr/R-3.0.1/bin
二是ln -s /usr/R-3.3.0/bin/R /usr/local/bin/R
输入R 看是否可以出现命令行窗口
$ wget
$ sudo yum install --nogpgcheck rstudio-server-rhel-0.99.903-x86_64.rpm
在本地执行: 看是否可以出现登录界面, 可以使用linux 中自定义的用户来登录
$ sudo firewall-cmd --zone=public --add-port=8787/tcp --permanent
$ sudo firewall-cmd –reload
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9036/viewspace-2122686/,如需转载,请注明出处,否则将追究法律责任。