查看系统:



[root@rhel7 home]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
[root@rhel7 home]# hostnamectl
Static hostname: rhel7
Icon name: computer-vm
Chassis: vm
Machine ID: ad6978e78a4642db92f7fa4f4faf5934
Boot ID: ecf326d768134d9ebed480d41dcfd91b
Virtualization: vmware
Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64


 

1、下载安装包



[root@rhel7 home]# wget https://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.6.3.tar.gz
--2021-02-01 01:30:54-- 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’

100%[===========================================================================================>] 33,308,185 42.6MB/s in 0.7s

2021-02-01 01:30:55 (42.6 MB/s) - ‘R-3.6.3.tar.gz’ saved [33308185/33308185]

[root@rhel7 home]# ls
liujiaxin01 R-3.6.3.tar.gz
[root@rhel7 home]# tar -xzvf R-3.6.3.tar.gz
[root@rhel7 home]# ls
liujiaxin01 R-3.6.3 R-3.6.3.tar.gz
[root@rhel7 home]# cd R-3.6.3/
[root@rhel7 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@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking for cl.exe... no
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@rhel7 R-3.6.3]# yum install gcc-c++ gcc-gfortran -y
…………
…………
Installed:
gcc-c++.x86_64 0:4.8.5-44.el7 gcc-gfortran.x86_64 0:4.8.5-44.el7

Dependency Installed:
cpp.x86_64 0:4.8.5-44.el7 gcc.x86_64 0:4.8.5-44.el7 glibc-devel.x86_64 0:2.17-317.el7
glibc-headers.x86_64 0:2.17-317.el7 kernel-headers.x86_64 0:3.10.0-1160.el7 libgfortran.x86_64 0:4.8.5-44.el7
libquadmath.x86_64 0:4.8.5-44.el7 libquadmath-devel.x86_64 0:4.8.5-44.el7 libstdc++-devel.x86_64 0:4.8.5-44.el7

Complete!


 

4、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking for main in -ltermlib... no
checking for rl_callback_read_char in -lreadline... no
configure: error: --with-readline=yes (default) and headers/libs are not available


 

5、



[root@rhel7 R-3.6.3]# yum install readline-devel -y
…………
…………
Installed:
readline-devel.x86_64 0:6.2-11.el7

Dependency Installed:
ncurses-devel.x86_64 0:5.9-14.20130511.el7_4

Complete!


 

6、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking X11/Intrinsic.h presence... no
checking for X11/Intrinsic.h... no
configure: error: --with-x=yes (default) and X11 headers/libs are not available


 

7、



[root@rhel7 R-3.6.3]# yum install libXt-devel -y
…………
…………
Installed:
libXt-devel.x86_64 0:1.1.5-3.el7

Dependency Installed:
libICE-devel.x86_64 0:1.0.9-9.el7 libSM-devel.x86_64 0:1.2.2-2.el7

Complete!


 

8、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking for XDR support... yes
checking for inflateInit2_ in -lz... no
checking whether zlib support suffices... configure: error: zlib library and headers are required


 

9、



[root@rhel7 R-3.6.3]# yum install zlib-devel bzip2-devel -y
…………
…………
Installed:
bzip2-devel.x86_64 0:1.0.6-13.el7 zlib-devel.x86_64 0:1.2.7-18.el7

Complete!


 

10、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking whether bzip2 support suffices... yes
checking for lzma_version_number in -llzma... no
configure: error: "liblzma library and headers are required"


 

11、



[root@rhel7 R-3.6.3]# yum -y install xz-devel.x86_64
…………
…………
Installed:
xz-devel.x86_64 0:5.2.2-1.el7

Complete!


 

12、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking if lzma version >= 5.0.3... yes
checking for pcre_fullinfo in -lpcre... no
checking whether PCRE support suffices... configure: error: pcre >= 8.20 library and headers are required


 

13、



[root@rhel7 R-3.6.3]# yum install pcre -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Package pcre-8.32-17.el7.x86_64 already installed and latest version
Nothing to do


 

14、



[root@rhel7 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking if lzma version >= 5.0.3... yes
checking for pcre_fullinfo in -lpcre... no
checking whether PCRE support suffices... configure: error: pcre >= 8.20 library and headers are required


 

15、



[root@rhel7 R-3.6.3]# yum install pcre-devel -y
…………
…………
Installed:
pcre-devel.x86_64 0:8.32-17.el7

Complete!


 

16、



[root@rhel7 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


 

17、



[root@rhel7 R-3.6.3]# yum install curl -y
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Package curl-7.29.0-59.el7.x86_64 already installed and latest version
Nothing to do
[root@rhel7 R-3.6.3]# yum install curl-devel -y
…………
…………
Installed:
libcurl-devel.x86_64 0:7.29.0-59.el7

Complete!


 

18、



[root@rhel7 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


 

19、



[root@rhel7 R-3.6.3]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
…………
…………
Installed:
java-1.8.0-openjdk-devel.x86_64 1:1.8.0.262.b10-1.el7

Complete!


 

20、



[root@rhel7 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


 

21、



[root@rhel7 R-3.6.3]# make
…………
…………
Java library path: $(JAVA_HOME)/lib/amd64/server
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'


 

22、



[root@rhel7 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'


 

23、测试R



[root@rhel7 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.

> 1 + 2
[1] 3


安装完成。