查看系统:
[root@centos8 home]# cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core)
1、下载R安装包
[root@centos8 home]# wget https://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.6.3.tar.gz
--2021-02-01 04:01:52-- https://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.6.3.tar.gz
Resolving mirror.bjtu.edu.cn (mirror.bjtu.edu.cn)... 202.112.154.58, 2001:da8:205::58
Connecting to mirror.bjtu.edu.cn (mirror.bjtu.edu.cn)|202.112.154.58|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33308185 (32M) [application/octet-stream]
Saving to: ‘R-3.6.3.tar.gz’
R-3.6.3.tar.gz 100%[==========================================================>] 31.76M 75.2MB/s in 0.4s
2021-02-01 04:01:52 (75.2 MB/s) - ‘R-3.6.3.tar.gz’ saved [33308185/33308185]
[root@centos8 home]# ls
liujiaxin01 R-3.6.3.tar.gz
[root@centos8 home]# tar -xzvf R-3.6.3.tar.gz
[root@centos8 home]# ls
liujiaxin01 R-3.6.3 R-3.6.3.tar.gz
[root@centos8 home]# cd R-3.6.3/
[root@centos8 R-3.6.3]# ls
ChangeLog configure COPYING etc m4 Makefile.fw po share SVN-REVISION tools VERSION-NICK
config.site configure.ac doc INSTALL Makeconf.in Makefile.in README src tests VERSION
2、安装
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
configure: error: in `/home/R-3.6.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details
3、
[root@centos8 R-3.6.3]# yum install gcc-c++ gcc-gfortran -y
…………
…………
Installed:
gcc-c++-8.3.1-5.1.el8.x86_64 gcc-gfortran-8.3.1-5.1.el8.x86_64 cpp-8.3.1-5.1.el8.x86_64
gcc-8.3.1-5.1.el8.x86_64 isl-0.16.1-6.el8.x86_64 libquadmath-devel-8.3.1-5.1.el8.x86_64
libstdc++-devel-8.3.1-5.1.el8.x86_64 glibc-devel-2.28-127.el8.x86_64 glibc-headers-2.28-127.el8.x86_64
kernel-headers-4.18.0-240.10.1.el8_3.x86_64 libgfortran-8.3.1-5.1.el8.x86_64 libquadmath-8.3.1-5.1.el8.x86_64
libxcrypt-devel-4.1.1-4.el8.x86_64
Complete!
4、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for rl_callback_read_char in -lreadline... no
configure: error: --with-readline=yes (default) and headers/libs are not available
5、
[root@centos8 R-3.6.3]# yum install readline-devel -y
…………
…………
Installed:
readline-devel-7.0-10.el8.x86_64 ncurses-c++-libs-6.1-7.20180224.el8.x86_64 ncurses-devel-6.1-7.20180224.el8.x86_64
Complete!
6、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for ICU... no
checking for X... no
configure: error: --with-x=yes (default) and X11 headers/libs are not available
7、
[root@centos8 R-3.6.3]# yum install libXt-devel -y
…………
…………
Installed:
libXt-devel-1.1.5-12.el8.x86_64 libICE-devel-1.0.9-15.el8.x86_64 libSM-devel-1.2.3-1.el8.x86_64
libX11-devel-1.6.8-3.el8.x86_64 libXau-devel-1.0.9-3.el8.x86_64 libxcb-devel-1.13.1-1.el8.x86_64
xorg-x11-proto-devel-2020.1-3.el8.noarch
Complete!
8、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for inflateInit2_ in -lz... no
checking whether zlib support suffices... configure: error: zlib library and headers are required
9、
[root@centos8 R-3.6.3]# yum install zlib-devel bzip2-devel -y
…………
…………
Installed:
bzip2-devel-1.0.6-26.el8.x86_64 zlib-devel-1.2.11-16.el8_2.x86_64
Complete!
10、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for lzma_version_number in -llzma... no
configure: error: "liblzma library and headers are required"
11、
[root@centos8 R-3.6.3]# yum -y install xz-devel.x86_64
…………
…………
Installed:
xz-devel-5.2.4-3.el8.x86_64
Complete!
12、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for pcre_fullinfo in -lpcre... no
checking whether PCRE support suffices... configure: error: pcre >= 8.20 library and headers are required
13、
[root@centos8 R-3.6.3]# yum install pcre pcre-devel -y
…………
…………
Installed:
pcre-devel-8.42-4.el8.x86_64 pcre-cpp-8.42-4.el8.x86_64 pcre-utf16-8.42-4.el8.x86_64 pcre-utf32-8.42-4.el8.x86_64
Complete!
14、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
checking for curl/curl.h... no
configure: error: libcurl >= 7.22.0 library and headers are required with support for https
15、
[root@centos8 R-3.6.3]# yum install curl curl-devel -y
…………
…………
Installed:
libcurl-devel-7.61.1-14.el8_3.1.x86_64 libssh-config-0.9.4-2.el8.noarch
Complete!
16、
[root@centos8 R-3.6.3]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
…………
…………
Installed:
java-1.8.0-openjdk-1:1.8.0.275.b01-1.el8_3.x86_64 java-1.8.0-openjdk-devel-1:1.8.0.275.b01-1.el8_3.x86_64
copy-jdk-configs-3.7-4.el8.noarch java-1.8.0-openjdk-headless-1:1.8.0.275.b01-1.el8_3.x86_64
javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch ttmkfdir-3.0.9-54.el8.x86_64
tzdata-java-2021a-1.el8.noarch xorg-x11-fonts-Type1-7.5-19.el8.noarch
lksctp-tools-1.0.18-3.el8.x86_64
Complete!
17、
[root@centos8 R-3.6.3]# ./configure --enable-R-shlib
…………
…………
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
18、
[root@centos8 R-3.6.3]# make
…………
…………
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
Updating Java configuration in /home/R-3.6.3
Done.
make[1]: Leaving directory '/home/R-3.6.3'
19、
[root@centos8 R-3.6.3]# make install
…………
…………
make[1]: Leaving directory '/home/R-3.6.3/src'
make[1]: Entering directory '/home/R-3.6.3/tests'
make[1]: Nothing to be done for 'install'.
make[1]: Leaving directory '/home/R-3.6.3/tests'
20、测试R
[root@centos8 R-3.6.3]# R
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-pc-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.
> 5 - 8
[1] -3
安装完成。
21、参考:
https://blog.csdn.net/stone1116/article/details/112986790
https://blog.csdn.net/wumiqing1/article/details/54232345
https://blog.csdn.net/john_f_lau/article/details/17652523
http://blog.sina.com.cn/s/blog_6caea8bf0100zfbu.html
https://blog.csdn.net/weixin_43404791/article/details/108980273