1、查看系统版本
[root@centos7PC1 home]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.9.2009 (Core) Release: 7.9.2009 Codename: Core
[root@centos7PC1 home]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core)
2、测试R
[root@centos7PC1 home]# R ## 没有R
bash: R: command not found...
3、安装R
[root@centos7PC1 home]# yum install epel-release -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package epel-release.noarch 0:7-11 will be installed --> Finished Dependency Resolution Dependencies Resolved ===================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================== Installing: epel-release noarch 7-11 extras 15 k Transaction Summary ===================================================================================================================================== Install 1 Package Total download size: 15 k Installed size: 24 k Downloading packages: epel-release-7-11.noarch.rpm | 15 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : epel-release-7-11.noarch 1/1 Verifying : epel-release-7-11.noarch 1/1 Installed: epel-release.noarch 0:7-11 Complete!
[root@centos7PC1 home]# yum install R -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * epel: mirror.sjtu.edu.cn * extras: mirrors.huaweicloud.com * updates: mirrors.huaweicloud.com Resolving Dependencies --> Running transaction check ---> Package R.x86_64 0:3.6.0-1.el7 will be installed ………… zlib-devel.x86_64 0:1.2.7-18.el7 zziplib.x86_64 0:0.13.62-12.el7 Dependency Updated: freetype.x86_64 0:2.8-14.el7_9.1 java-1.8.0-openjdk.x86_64 1:1.8.0.282.b08-1.el7_9 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!
4、测试R
[root@centos7PC1 home]# R ## 可以调用 R version 3.6.0 (2019-04-26) -- "Planting of a Tree" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-redhat-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. > sample(1:10,5) [1] 4 10 2 6 3
> seq (5) [1] 1 2 3 4 5
> seq (1,10,2) [1] 1 3 5 7 9