linux系统centos7.9安装R(编译安装)

摘要:
已安装:gcc-c++x86

查看系统:

[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

免责声明:文章转载自《linux系统centos7.9安装R(编译安装)》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Linux NFS服务器的安装与配置(转载)MySQL Innodb 并发涉及参数下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

Linux下安装项目管理工具Redmine

http://www.redmine.org.cn/download Linux下安装项目管理工具Redmine1、Ruby安装Ruby on Rails网站推荐使用1.8.7版。 点击(此处)折叠或打开 # wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz # tar...

使用Debian的kernelpackage系统创建自己的内核

使用Debian的kernel-package系统创建自己的内核 1.简介我曾经手动编译内核,这必须按顺序进行一系列的步骤;kernel-package就是写来完成这些所必须的步骤的.(现在他已超出这个范畴,但是实际上, 那正是他所完成的).这对于新手来说是相当重要的:make-kpkg完成了编译一个内核所需的所有步骤,并且内核的安装是一个快照.--...

Ubuntu环境下使用Unity3D调用C++编写的Linux so动态链接库

Unity3D已经有了支持Linux的社区版本。要在Linux环境下开发Unity3D程序,首先要安装Linux版的Unity。地址如下: https://forum.unity3d.com/threads/unity-on-linux-release-notes-and-known-issues.350256/#post-2556301 1 制作Linu...

Linux开机自动挂载存储的两种方式

登录服务器,给查看了下,发现确实是没有自动加载,df -h只能显示本地硬盘的分区,fdisk -l 还是能看到存储空间,这说明这个服务器连接存储是木有问题的。 输入history | grep mount,查看所有mount记录,最后一条为:mount /dev/emcpowerb1 /oracle/oradata。复制出来,粘贴到命令行,回车后就挂载上了...

Linux内核分析总结

周子轩 原创作品转载注明出处 《Linux内核分析》MOOC课程http://mooc.study.163.com/course/USTC-1000029000 笔记: 冯诺依曼体系结构的核心思想是存储程序计算机。在计算机中有两种指令,一是用户指令,一是系统调用。 Linux是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统...

windows用浏览器访问linux目录文件

背景:开发环境没有测试环境服务器的权限,但开发想上测试环境看日志或者配置之类的,测试不用新开一个账号,只要用以下命令, 前提是要有python3环境 python3 -m http.server 59999 端口自己任意配置,比如你要临时给etc下面目录所有文件的查看权限,先进入到opt目录,再使用以上命令 然后在windows机器上的浏览器输入你服务的i...