zoukankan      html  css  js  c++  java
  • linux系统centos7.9安装R(编译安装)

    查看系统:

    [root@centos7 ~]# cat /etc/redhat-release
    CentOS Linux release 7.9.2009 (Core)
    [root@centos7 ~]# hostnamectl
       Static hostname: centos7
             Icon name: computer-vm
               Chassis: vm
            Machine ID: 800a83c5a11f46b5bcfb4fd5700d3f0e
               Boot ID: 0c55cc128ec04b689715398316da76a4
        Virtualization: vmware
      Operating System: CentOS Linux 7 (Core)
           CPE OS Name: cpe:/o:centos:centos:7
                Kernel: Linux 3.10.0-1160.el7.x86_64
          Architecture: x86-64

    1、下载R安装包

    [root@centos7 home]# wget https://mirror.bjtu.edu.cn/cran/src/base/R-3/R-3.6.3.tar.gz
    --2021-01-31 23:52:23--  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  72.4MB/s   in 0.4s
    
    2021-01-31 23:52:23 (72.4 MB/s) - ‘R-3.6.3.tar.gz’ saved [33308185/33308185]
    
    [root@centos7 home]# ls
    liujiaxin01  R-3.6.3.tar.gz
    [root@centos7 home]# tar -xzvf R-3.6.3.tar.gz
    [root@centos7 home]# cd R-3.6.3/
    [root@centos7 R-3.6.3]# ls
    ChangeLog    configure.ac  etc      Makeconf.in  po      src           tools
    config.site  COPYING       INSTALL  Makefile.fw  README  SVN-REVISION  VERSION
    configure    doc           m4       Makefile.in  share   tests         VERSION-NICK

    2、编译

    [root@centos7 R-3.6.3]# ./configure  --enable-R-shlib
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    loading site script './config.site'
    loading build-specific script './config.site'
    checking for pwd... /usr/bin/pwd
    checking whether builddir is srcdir... yes
    checking whether ln -s works... yes
    checking for ar... ar
    checking for a BSD-compatible install... /usr/bin/install -c
    checking for sed... /usr/bin/sed
    checking for which... /usr/bin/which
    checking for less... /usr/bin/less
    checking for gtar... /usr/bin/gtar
    checking for tex... no
    checking for pdftex... no
    configure: WARNING: you cannot build PDF versions of the R manuals
    checking for pdflatex... no
    configure: WARNING: you cannot build PDF versions of vignettes and help pages
    checking for makeindex... no
    checking for texi2any... no
    configure: WARNING: you cannot build info or HTML versions of the R manuals
    checking for texi2dvi... no
    checking for kpsewhich... no
    checking for latex inconsolata package... checking for unzip... /usr/bin/unzip
    checking for zip... /usr/bin/zip
    checking for gzip... /usr/bin/gzip
    checking for bzip2... /usr/bin/bzip2
    checking for firefox... /usr/bin/firefox
    using default browser ... /usr/bin/firefox
    checking for acroread... no
    checking for acroread4... no
    checking for xdg-open... /usr/bin/xdg-open
    checking for working aclocal... missing
    checking for working autoconf... missing
    checking for working autoheader... missing
    checking for bison... no
    checking for byacc... no
    checking for yacc... no
    checking for notangle... false
    checking for realpath... /usr/bin/realpath
    checking for pkg-config... /usr/bin/pkg-config
    checking for gcc... no
    checking for cc... no
    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@centos7 R-3.6.3]# yum install gcc-c++ -y
    ……
    Installed:
      gcc-c++.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           libstdc++-devel.x86_64 0:4.8.5-44.el7
    
    Complete!

    4、

    [root@centos7 R-3.6.3]# ./configure  --enable-R-shlib
    …………
    …………
    checking whether we are using the GNU Fortran compiler... no
    checking whether  accepts -g... no
    configure: error: No Fortran compiler found

    5、

    [root@centos7 R-3.6.3]# yum install gcc-gfortran -y
    …………
    …………
    Dependency Installed:
      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
    
    Complete!

    6、

    [root@centos7 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@centos7 R-3.6.3]# yum install readline-devel -y
    …………
    …………
    Dependency Installed:
      ncurses-devel.x86_64 0:5.9-14.20130511.el7_4
    
    Complete!

    8、

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

    9、

    [root@centos7 R-3.6.3]# yum install libXt-devel -y
    Dependency Installed:
      libICE-devel.x86_64 0:1.0.9-9.el7                           libSM-devel.x86_64 0:1.2.2-2.el7
    
    Complete!

    10、

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

    11、

    [root@centos7 R-3.6.3]# yum install zlib-devel -y
    …………
    …………
    Installed:
      zlib-devel.x86_64 0:1.2.7-18.el7
    
    Complete!

    12、

    [root@centos7 R-3.6.3]# ./configure  --enable-R-shlib
    …………
    …………
    checking mmap support for zlib... yes
    checking for BZ2_bzlibVersion in -lbz2... no
    checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required

    13、

    [root@centos7 R-3.6.3]# yum -y install bzip2-devel
    …………
    …………
    Installed:
      bzip2-devel.x86_64 0:1.0.6-13.el7
    
    Complete!

    14、

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

    15、

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

    16、

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

    17、

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

    18、

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

    19、

    [root@centos7 R-3.6.3]# yum install curl curl-devel -y
    …………
    …………
    Updated:
      curl.x86_64 0:7.29.0-59.el7_9.1
    
    Dependency Updated:
      libcurl.x86_64 0:7.29.0-59.el7_9.1
    
    Complete!

    20、

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

    21、

    [root@centos7 R-3.6.3]# make
    …………
    …………
    …………
    gcc -std=gnu99 -I"/home/R-3.6.3/include" -DNDEBUG   -I/usr/local/include  -fpic  -g -O2  -c conftest.c -o conftest.o
    conftest.c:1:17: fatal error: jni.h: No such file or directory
     #include <jni.h>
                     ^
    compilation terminated.
    make[2]: *** [conftest.o] Error 1
    make[2]: Leaving directory `/tmp/Rjavareconf.ZNGgzx'
    Unable to compile a JNI program
    
    
    JAVA_HOME        : /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64/jre
    Java library path:
    JNI cpp flags    :
    JNI linker flags :
    Updating Java configuration in /home/R-3.6.3
    Done.
    
    make[1]: Leaving directory `/home/R-3.6.3'

    22、

    [root@centos7 R-3.6.3]# yum -y install java-1.8.0-openjdk java-1.8.0-openjdk-devel
    …………
    …………
    Dependency Updated:
      java-1.8.0-openjdk-headless.x86_64 1:1.8.0.282.b08-1.el7_9               tzdata-java.noarch 0:2021a-1.el7
    
    Complete!

    23、

    [root@centos7 R-3.6.3]# make
    …………
    …………
    make[1]: Leaving directory `/home/R-3.6.3/src/library'
    make[1]: Entering directory `/home/R-3.6.3'
    make[1]: `stamp-java' is up to date.
    make[1]: Leaving directory `/home/R-3.6.3'

    24、

    [root@centos7 R-3.6.3]# make install
    …………
    …………
    make[2]: Leaving directory `/home/R-3.6.3/src/library'
    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'

    25、测试R

    [root@centos7 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.
    
    > 2 + 5
    [1] 7
    > 10 * 5
    [1] 50
    > quit()

    安装完成。

    参考:

    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

  • 相关阅读:
    [leetcode] #279 Perfect Squares (medium)
    vue-cli3.0配置详解
    babel7 的配置加载逻辑
    webpack-小滴课堂学习笔记
    VUE-cli3使用 svg-sprite-loader
    打包报错,提示UglifyJs Unexpected token: keyword «const»
    UglifyJs报Unexpected token punc «:», expected punc «,» 这类错误的解决办法
    element-ui实现部分引用
    图解 HTTP 缓存
    process.argv
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14354822.html
Copyright © 2011-2022 走看看