说明我的系统是centos6的,开始我是下载R-3.4.0.tar.gz的,在问题集锦第六个问题就过不去了,然后根据网友的意见
3.3以后得用centos7,不然依赖版本不兼容
很头大的问题
给它来个3.3以下的
输入R,看是否能够进入R语言
R
或检查R的版本
R --version
#2. 下载R-3.0.0.tar.gz
https://www.r-project.org/
https://cloud.r-project.org/src/base/
https://cloud.r-project.org/src/base/R-3/
#3. 上传到linux的/opt/software
目录下
#4. 解压
[root@biluos1 R-3.0.0]# mkdir -p /opt/moudles/R
[root@biluos1 ~]# tar -zxvf /opt/software/R-3.0.0.tar.gz -C /opt/moudles/R/
#5. 创建安装目录
[root@biluos1 R-3.0.0]# mkdir -p /opt/moudles/R/R
[root@biluos1 R-3.0.0]# ./configure --prefix=/opt/moudles/R/R --enable-R-shlib
只看最后三四行报错,然后在问题集锦里找到解决方法,一个一个的解决,
问题:1
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking if zlib version >= 1.2.5... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
zlib版本太低,必须要大于1.2.5版本的。直接看是zlib没安装导致的,yum list |grep zlib*
看到的是全部都安装好的;
解决方法:
linux下Zlib的安装与使用 :http://blog.csdn.net/qq_21383435/article/details/79539034
问题:2
checking if bzip2 version >= 1.0.6... no
checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required
原因:
bzip2 版本太低,必须要大于1.0.6版本的。
查看yum list |grep bzip2*
看到的是全部都安装好的;
解决方法:http://blog.csdn.net/qq_21383435/article/details/79539311
问题:3
configure: error: --with-readline=yes (default) and headers/libs are not available
解决方法:yum install readline-devel
问题:4
configure: error: --with-x=yes (default) and X11 headers/libs are not available
解决方法:yum install libXt-devel
问题:5
checking for lzma_version_number in -llzma... no configure: error: "liblzma library and headers are required
解决方法:yum -y install xz-devel.x86_64
问题:6
checking if lzma version >= 5.0.3... no configure: error: "liblzma library and headers are required"
解决方法:http://blog.csdn.net/qq_21383435/article/details/79540117
[root@biluos1 R-3.0.0]# ./configure --prefix=/opt/moudles/R/R --enable-R-shlib
config.status: creating src/include/config.h
config.status: executing libtool commands
config.status: executing stamp-h commands
R is now configured for x86_64-unknown-linux-gnu
Source directory: .
Installation directory: /opt/moudles/R/R
C compiler: gcc -std=gnu99 -g -O2
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler:
Interfaces supported: X11
External libraries: readline
Additional capabilities: NLS
Options enabled: shared R library, shared BLAS, R profiling
Recommended packages: yes
configure: WARNING: you cannot build info or HTML versions of the R manuals
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of vignettes and help pages
#9. 执行make
[root@biluos1 R-3.0.0]# make
** R
** data
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (mgcv)
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/library/Recommended'
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/src/library/Recommended'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/src/library'
'pdflatex' is needed to make vignettes but is missing on your system.
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/src/library'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0'
configuring Java ...
Java interpreter : /opt/moudles/jdk1.8.0_121/jre/bin/java
Java version : 1.8.0_121
Java home path : /opt/moudles/jdk1.8.0_121
Java compiler : /opt/moudles/jdk1.8.0_121/bin/javac
Java headers gen.: /opt/moudles/jdk1.8.0_121/bin/javah
Java archive tool: /opt/moudles/jdk1.8.0_121/bin/jar
trying to compile and link a JNI progam
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
detected JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
make[2]: Entering directory `/tmp/RJRECONF.KmNlZk'
gcc -std=gnu99 -I/opt/moudles/R/R-3.0.0/include -DNDEBUG -I/opt/moudles/jdk1.8.0_121/include -I/opt/moudles/jdk1.8.0_121/include/linux -I/usr/local/include -fpic -g -O2 -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/local/lib64 -o conftest.so conftest.o -L/opt/moudles/jdk1.8.0_121/jre/lib/amd64/server -ljvm -L/opt/moudles/R/R-3.0.0/lib -lR
make[2]: Leaving directory `/tmp/RJRECONF.KmNlZk'
Java library path: $(JAVA_HOME)/jre/lib/amd64/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
Updating Java configuration in /opt/moudles/R/R-3.0.0
Done.
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0'
You have new mail in /var/spool/mai
[root@biluos1 R-3.0.0]# make install
mkdir -p -- /opt/moudles/R/R/lib64/R
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/m4'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/m4'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/tools'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/tools'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/doc'
installing doc ...
mkdir -p -- /opt/moudles/R/R/lib64/R/doc
mkdir -p -- /opt/moudles/R/R/share/man/man1
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/doc/html'
installing doc/html ...
mkdir -p -- /opt/moudles/R/R/lib64/R/doc/html
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/doc/html'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/doc/manual'
installing doc/manual ...
mkdir -p -- /opt/moudles/R/R/lib64/R/doc/manual
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/doc/manual'
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/doc'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/etc'
mkdir -p -- /opt/moudles/R/R/lib64/R/etc
installing etc ...
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/etc'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/share'
installing share ...
mkdir -p -- /opt/moudles/R/R/lib64/R/share
mkdir -p -- /opt/moudles/R/R/lib64/R/share/R
mkdir -p -- /opt/moudles/R/R/lib64/R/share/dictionaries
mkdir -p -- /opt/moudles/R/R/lib64/R/share/encodings
mkdir -p -- /opt/moudles/R/R/lib64/R/share/java
mkdir -p -- /opt/moudles/R/R/lib64/R/share/licenses
mkdir -p -- /opt/moudles/R/R/lib64/R/share/make
mkdir -p -- /opt/moudles/R/R/lib64/R/share/sh
mkdir -p -- /opt/moudles/R/R/lib64/R/share/texmf
mkdir -p -- /opt/moudles/R/R/lib64/R/share/texmf/bibtex/bib
mkdir -p -- /opt/moudles/R/R/lib64/R/share/texmf/bibtex/bst
mkdir -p -- /opt/moudles/R/R/lib64/R/share/texmf/tex/latex
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/share'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/src'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/scripts'
mkdir -p -- /opt/moudles/R/R/bin
mkdir -p -- /opt/moudles/R/R/lib64/R/bin
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/scripts'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/include'
mkdir -p -- /opt/moudles/R/R/lib64/R/include
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/include/R_ext'
mkdir -p -- /opt/moudles/R/R/lib64/R/include/R_ext
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/include/R_ext'
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/include'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/blas'
mkdir -p -- /opt/moudles/R/R/lib64/R/lib
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/blas'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/bzip2'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/bzip2'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/pcre'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/pcre'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/tre'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/tre'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/xdr'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/xdr'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/xz'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/xz'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/zlib'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/zlib'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/extra/intl'
make[3]: Nothing to be done for `install'.
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra/intl'
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/extra'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/appl'
make[2]: Nothing to be done for `install'.
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/appl'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/nmath'
make[2]: Nothing to be done for `install'.
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/nmath'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/unix'
gcc -std=gnu99 -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fopenmp -fpic -g -O2 -DR_HOME='"/opt/moudles/R/R/lib64/R"' -o Rscript \
./Rscript.c
mkdir -p -- /opt/moudles/R/R/lib64/pkgconfig
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/unix'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/main'
mkdir -p -- /opt/moudles/R/R/lib64/R/bin/exec
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/main'
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/main'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/main'
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/main'
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/main'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/modules'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/modules/internet'
mkdir -p -- /opt/moudles/R/R/lib64/R/modules
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/modules/internet'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/modules/lapack'
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/modules/lapack'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/modules/vfonts'
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/modules/vfonts'
make[3]: Entering directory `/opt/moudles/R/R-3.0.0/src/modules/X11'
make[3]: Leaving directory `/opt/moudles/R/R-3.0.0/src/modules/X11'
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/modules'
make[2]: Entering directory `/opt/moudles/R/R-3.0.0/src/library'
mkdir -p -- /opt/moudles/R/R/lib64/R/library
installing packages ...
building HTML index ...
make[2]: Leaving directory `/opt/moudles/R/R-3.0.0/src/library'
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/src'
make[1]: Entering directory `/opt/moudles/R/R-3.0.0/tests'
make[1]: Nothing to be done for `install'.
make[1]: Leaving directory `/opt/moudles/R/R-3.0.0/tests'
[root@biluos1 R-3.0.0]#
成功后
配置R的环境变量
vi /etc/profile
export R_HOME=/opt/moudles/R/R
export PATH=$R_HOME/bin
使文件生效
[root@biluos1 R-3.0.0]# source /etc/profile
[root@biluos1 R-3.0.0]# R
/opt/moudles/R/R/bin/R: line 8: uname: command not found
WARNING: ignoring environment value of R_HOME
R version 3.0.0 (2013-04-03) -- "Masked Marvel"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-unknown-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.
>
参考:
http://blog.csdn.net/wumiqing1/article/details/54232345#reply
http://blog.csdn.net/shen19920619/article/details/69159249
http://blog.csdn.net/qq_34023608/article/details/51700974
http://blog.csdn.net/blyhaha/article/details/38019133