linux系统redhat 8.3 安装R

1、查看当前系统:

[root@rhel8 home]# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.3 (Ootpa)
[root@rhel8 home]# hostnamectl
   Static hostname: rhel8
         Icon name: computer-vm
           Chassis: vm
        Machine ID: bd17d96c46664b648189528dede70fa5
           Boot ID: 9ea60af5584142d685d2b13bd5ad2929
    Virtualization: vmware
  Operating System: Red Hat Enterprise Linux 8.3 (Ootpa)
       CPE OS Name: cpe:/o:redhat:enterprise_linux:8.3:GA
            Kernel: Linux 4.18.0-240.el8.x86_64
      Architecture: x86-64

2、测试R

[root@rhel8 home]# R
bash: R: command not found...

3、下载R安装包

[root@rhel8 home]# wget https://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.6.3.tar.gz
--2021-02-01 13:45:49--  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  69.6MB/s    in 0.5s

2021-02-01 13:45:50 (69.6 MB/s) - ‘R-3.6.3.tar.gz’ saved [33308185/33308185]

[root@rhel8 home]# ls
liujiaxin01  R-3.6.3.tar.gz
[root@rhel8 home]# tar -xzvf R-3.6.3.tar.gz
[root@rhel8 home]# cd R-3.6.3/
[root@rhel8 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

4、安装

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

5、

[root@rhel8 R-3.6.3]# yum install gcc-c++ gcc-gfortran -y
…………
…………
Installed:
  cpp-8.3.1-5.1.el8.x86_64                  gcc-8.3.1-5.1.el8.x86_64                      gcc-c++-8.3.1-5.1.el8.x86_64
  gcc-gfortran-8.3.1-5.1.el8.x86_64         glibc-devel-2.28-127.el8.x86_64               glibc-headers-2.28-127.el8.x86_64
  isl-0.16.1-6.el8.x86_64                   kernel-headers-4.18.0-240.el8.x86_64          libgfortran-8.3.1-5.1.el8.x86_64
  libquadmath-8.3.1-5.1.el8.x86_64          libquadmath-devel-8.3.1-5.1.el8.x86_64        libstdc++-devel-8.3.1-5.1.el8.x86_64
  libxcrypt-devel-4.1.1-4.el8.x86_64

Complete!

6、

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

7、

[root@rhel8 R-3.6.3]# yum install readline-devel -y
…………
…………
Installed:
  ncurses-c++-libs-6.1-7.20180224.el8.x86_64      ncurses-devel-6.1-7.20180224.el8.x86_64      readline-devel-7.0-10.el8.x86_64

Complete!

8、

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

9、

[root@rhel8 R-3.6.3]# yum install libXt-devel -y
…………
…………
Installed:
  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                  libXt-devel-1.1.5-12.el8.x86_64         libxcb-devel-1.13.1-1.el8.x86_64
  xorg-x11-proto-devel-2020.1-3.el8.noarch

Complete!

10、

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

11、

[root@rhel8 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!

12、

[root@rhel8 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"

13、

[root@rhel8 R-3.6.3]# yum -y install xz-devel.x86_64
…………
…………
Installed:
  xz-devel-5.2.4-3.el8.x86_64

Complete!

14、

[root@rhel8 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@rhel8 R-3.6.3]# yum install pcre pcre-devel -y
…………
…………
Installed:
  pcre-cpp-8.42-4.el8.x86_64     pcre-devel-8.42-4.el8.x86_64     pcre-utf16-8.42-4.el8.x86_64     pcre-utf32-8.42-4.el8.x86_64

Complete!

16、

[root@rhel8 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
checking curl/curl.h presence... no
checking for curl/curl.h... no
configure: error: libcurl >= 7.22.0 library and headers are required with support for https

17、

[root@rhel8 R-3.6.3]# yum install curl curl-devel -y
…………
…………
Installed:
  libcurl-devel-7.61.1-14.el8.x86_64

Complete!

18、

[root@rhel8 R-3.6.3]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
…………
…………
Installed:
  copy-jdk-configs-3.7-4.el8.noarch                                    java-1.8.0-openjdk-1:1.8.0.265.b01-4.el8.x86_64
  java-1.8.0-openjdk-devel-1:1.8.0.265.b01-4.el8.x86_64                java-1.8.0-openjdk-headless-1:1.8.0.265.b01-4.el8.x86_64
  javapackages-filesystem-5.3.0-1.module+el8+2447+6f56d9a6.noarch      lksctp-tools-1.0.18-3.el8.x86_64
  ttmkfdir-3.0.9-54.el8.x86_64                                         tzdata-java-2020a-1.el8.noarch
  xorg-x11-fonts-Type1-7.5-19.el8.noarch

Complete!

19、

[root@rhel8 R-3.6.3]# ./configure  --enable-R-shlib
…………
…………
  Capabilities skipped:        PNG, JPEG, TIFF, cairo, ICU
  Options not enabled:         memory 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

20、

[root@rhel8 R-3.6.3]# make
…………
…………
Updating Java configuration in /home/R-3.6.3
Done.

make[1]: Leaving directory '/home/R-3.6.3'

21、

[root@rhel8 R-3.6.3]# make install
…………
…………
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'

22、测试R

[root@rhel8 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 + 6
[1] 11

安装完成。

23、参考:

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

原文地址:https://www.cnblogs.com/liujiaxin2018/p/14354930.html