Docker容器嵌入式开发:在Ubuntu上配置RStudio与R语言、可视化操作-程序员宅基地

技术标签: ubuntu  r语言  快速入门大数据与机器学习基础  docker  


以上是在Ubuntu 18.04上安装最新版本的R语言环境的步骤摘要。首先,通过添加CRAN镜像源并安装GPG密钥来配置软件源。然后,更新软件包列表并通过apt安装R语言。最后,可选地安装RStudio作为集成开发环境。验证安装的方法包括启动R并检查版本号,运行简单的R命令来确认功能正常,然后退出R。

一、dirmngr工具

dirmngr 是一个用于管理密钥和证书的工具,主要用于 GnuPG(GNU Privacy Guard)加密软件套件中。它是 GnuPG 中的一个独立的组件,负责处理密钥服务器的请求以及密钥和证书的管理。

dirmngr 主要的功能包括:

密钥管理:dirmngr 负责管理密钥环和密钥服务器之间的通信。它可以从密钥服务器上检索公钥、验证公钥的有效性,并将公钥导入到本地的密钥环中。

证书管理:除了密钥管理外,dirmngr 也可以处理 X.509 数字证书。它可以与证书颁发机构(CA)进行通信,验证证书的有效性,并确保它们的链完整性。

密钥服务器通信:dirmngr 能够与密钥服务器进行安全通信,例如通过 HTTP 或 LDAP 协议。它可以向密钥服务器发送请求以搜索、获取或删除公钥。

CRL(证书吊销列表)检查:dirmngr 还负责检查证书吊销列表以确保证书的有效性。它会定期检查 CA 发布的 CRL 并更新本地的列表。

安装方法:
安装 dirmngr:在终端中运行以下命令安装 dirmngr:

sudo apt-get install dirmngr

启动 dirmngr 服务:运行以下命令以启动 dirmngr 服务:

sudo systemctl start dirmngr

操作记录:

udo apt-get install dirmngr
Reading package lists... Done
Building dependency tree       
Reading state information... Done
dirmngr is already the newest version (2.2.4-1ubuntu1.6).
dirmngr set to manually installed.
The following packages were automatically installed and are no longer required:
  gyp libjs-async libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match
  node-block-stream node-brace-expansion node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data
  node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-hosted-git-info node-inflight node-inherits node-ini
  node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-path-is-absolute node-pseudomap node-qs node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent node-underscore node-validate-npm-package-license
  node-which node-wrappy node-yallist
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.
(tfv1) root@98031e181845:/data/myapp2024/myBigDataApplicationDevelopment# sudo systemctl start dirmngr
System has not been booted with systemd as init system (PID 1). Can't operate.
(tfv1) root@98031e181845:/data/myapp2024/myBigDataApplicationDevelopment# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
Executing: /tmp/apt-key-gpghome.D2zcggo6wW/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9
gpg: key 51716619E084DAB9: public key "Michael Rutter <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1

二、R环境安装与配置

再次尝试添加密钥:运行你之前的添加密钥命令:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 51716619E084DAB9

如果这些步骤仍然无法解决问题,可能是由于网络或密钥服务器方面的问题。你可以尝试等待一段时间后再次尝试,或者尝试使用其他密钥服务器。

添加CRAN镜像源:打开终端,并输入以下命令添加CRAN镜像源。这里以添加Cloudflare提供的CRAN镜像源为例,你也可以选择其他镜像源。

sudo sh -c 'echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/" >> /etc/apt/sources.list'

更新软件包列表:运行以下命令以更新软件包列表。

sudo apt update

安装R语言:最新版本的R语言已经添加到了CRAN镜像源中,现在可以通过以下命令安装R语言。

sudo apt install r-base

这将安装R语言的基本环境。如果你需要安装R的开发环境或其他扩展包,可以在安装完基本环境后再进行安装。

操作记录:

sudo sh -c 'echo "deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/" >> /etc/apt/sources.list'
(tfv1) root@98031e181845:/data/myapp2024/myBigDataApplicationDevelopment# sudo apt update
Get:1 file:/var/nv-tensorrt-repo-ubuntu1804-cuda11.1-trt7.2.3.4-ga-20210226  InRelease
Ign:1 file:/var/nv-tensorrt-repo-ubuntu1804-cuda11.1-trt7.2.3.4-ga-20210226  InRelease
Get:2 file:/var/nv-tensorrt-repo-ubuntu1804-cuda11.1-trt7.2.3.4-ga-20210226  Release [569 B]
Get:2 file:/var/nv-tensorrt-repo-ubuntu1804-cuda11.1-trt7.2.3.4-ga-20210226  Release [569 B]
Get:3 http://mirrors.aliyun.com/ubuntu bionic InRelease [242 kB]
Get:4 http://mirrors.aliyun.com/ubuntu bionic-security InRelease [88.7 kB]                                                
Get:5 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease [88.7 kB]                                                                                                     
Get:6 http://mirrors.aliyun.com/ubuntu bionic-proposed InRelease [242 kB]                                                                                                           
Get:8 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease [83.3 kB]                                                                                                         
Hit:9 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic InRelease                                                                                                               
Get:12 http://mirrors.aliyun.com/ubuntu bionic/universe Sources [11.5 MB]                                                                                                           
Get:13 http://ppa.launchpad.net/ethereum/ethereum/ubuntu bionic InRelease [15.4 kB]                                                                                                 
Hit:10 https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu1804/x86_64  InRelease                                                                                         
Get:14 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ InRelease [3,626 B]                                                                                              
Ign:15 https://dl.bintray.com/sbt/debian  InRelease                                                                                                                                 
Ign:11 https://developer.download.nvidia.cn/compute/machine-learning/repos/ubuntu1804/x86_64  InRelease                                                                       
Get:16 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ Packages [136 kB]                                                              
Hit:18 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu bionic InRelease                                 
Err:19 https://dl.bintray.com/sbt/debian  Release                                                               
  404  Not Found [IP: 18.232.172.199 443]
Hit:20 https://dl.yarnpkg.com/debian stable InRelease                                                           
Hit:17 https://developer.download.nvidia.cn/compute/machine-learning/repos/ubuntu1804/x86_64  Release                             
Get:21 http://mirrors.aliyun.com/ubuntu bionic/main Sources [1,063 kB]                                                            
Get:23 http://mirrors.aliyun.com/ubuntu bionic/restricted Sources [5,823 B]           
Get:24 http://mirrors.aliyun.com/ubuntu bionic/multiverse Sources [216 kB]
Get:25 http://mirrors.aliyun.com/ubuntu bionic/main amd64 Packages [1,344 kB]
Get:26 http://mirrors.aliyun.com/ubuntu bionic amd64 Contents (deb) [39.5 MB]
Get:27 http://mirrors.aliyun.com/ubuntu bionic/restricted amd64 Packages [13.5 kB]
Get:28 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 Packages [11.3 MB]
Get:29 http://mirrors.aliyun.com/ubuntu bionic/multiverse amd64 Packages [186 kB]                                                                                                   
Get:30 http://mirrors.aliyun.com/ubuntu bionic-security/main Sources [379 kB]                                                                                                       
Get:31 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse Sources [13.8 kB]                                                                                                
Get:32 http://mirrors.aliyun.com/ubuntu bionic-security/restricted Sources [38.8 kB]                                                                                                
Get:33 http://mirrors.aliyun.com/ubuntu bionic-security/universe Sources [420 kB]                                                                                                   
Get:34 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 Packages [3,373 kB]                                                                                              
Get:35 http://mirrors.aliyun.com/ubuntu bionic-security amd64 Contents (deb) [228 MB]                                                                                               
Get:36 http://mirrors.aliyun.com/ubuntu bionic-security/restricted amd64 Packages [1,688 kB]                                                                                        
Get:37 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 Packages [1,637 kB]                                                                                          
Get:38 http://mirrors.aliyun.com/ubuntu bionic-security/multiverse amd64 Packages [23.8 kB]                                                                                         
Get:39 http://mirrors.aliyun.com/ubuntu bionic-updates/main Sources [684 kB]                                                                                                        
Get:40 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse Sources [21.7 kB]                                                                                                 
Get:41 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted Sources [42.3 kB]                                                                                                 
Get:42 http://mirrors.aliyun.com/ubuntu bionic-updates/universe Sources [650 kB]                                                                                                    
Get:43 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 Packages [3,786 kB]                                                                                               
Get:44 http://mirrors.aliyun.com/ubuntu bionic-updates amd64 Contents (deb) [240 MB]                                                                                                
Get:45 http://mirrors.aliyun.com/ubuntu bionic-updates/restricted amd64 Packages [1,728 kB]                                                                                         
Get:46 http://mirrors.aliyun.com/ubuntu bionic-updates/universe amd64 Packages [2,411 kB]                                                                                           
Get:47 http://mirrors.aliyun.com/ubuntu bionic-updates/multiverse amd64 Packages [30.8 kB]                                                                                          
Get:48 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe Sources [7,042 B]                                                                                                  
Get:49 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted Sources [8,548 B]                                                                                                
Get:50 http://mirrors.aliyun.com/ubuntu bionic-proposed/main Sources [79.1 kB]                                                                                                      
Get:51 http://mirrors.aliyun.com/ubuntu bionic-proposed/main amd64 Packages [169 kB]                                                                                                
Get:52 http://mirrors.aliyun.com/ubuntu bionic-proposed amd64 Contents (deb) [6,563 kB]                                                                                             
Get:53 http://mirrors.aliyun.com/ubuntu bionic-proposed/restricted amd64 Packages [150 kB]                                                                                          
Get:54 http://mirrors.aliyun.com/ubuntu bionic-proposed/universe amd64 Packages [11.1 kB]                                                                                           
Get:55 http://mirrors.aliyun.com/ubuntu bionic-backports/main Sources [11.9 kB]                                                                                                     
Get:56 http://mirrors.aliyun.com/ubuntu bionic-backports/universe Sources [7,127 B]                                                                                                 
Get:57 http://mirrors.aliyun.com/ubuntu bionic-backports/main amd64 Packages [64.0 kB]                                                                                              
Get:58 http://mirrors.aliyun.com/ubuntu bionic-backports amd64 Contents (deb) [798 kB]                                                                                              
Get:59 http://mirrors.aliyun.com/ubuntu bionic-backports/universe amd64 Packages [20.6 kB]                                                                                          
Reading package lists... Done                                                                                                                                                       
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-amd64) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-all) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
E: The repository 'https://dl.bintray.com/sbt/debian  Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-amd64) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-all) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
(tfv1) root@98031e181845:/data/myapp2024/myBigDataApplicationDevelopment# sudo apt install r-base
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libjs-async libjs-inherits libjs-node-uuid libjs-underscore libuv1-dev node-abbrev node-ansi node-ansi-color-table node-archy node-async node-balanced-match
  node-block-stream node-brace-expansion node-builtin-modules node-combined-stream node-concat-map node-cookie-jar node-delayed-stream node-forever-agent node-form-data
  node-fs.realpath node-fstream node-fstream-ignore node-github-url-from-git node-glob node-graceful-fs node-hosted-git-info node-inflight node-inherits node-ini
  node-is-builtin-module node-isexe node-json-stringify-safe node-lockfile node-lru-cache node-mime node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  node-normalize-package-data node-npmlog node-once node-osenv node-path-is-absolute node-pseudomap node-qs node-read node-read-package-json node-request node-retry node-rimraf
  node-semver node-sha node-slide node-spdx-correct node-spdx-expression-parse node-spdx-license-ids node-tar node-tunnel-agent node-underscore node-validate-npm-package-license
  node-which node-wrappy node-yallist
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  bzip2-doc libbz2-dev libfile-basedir-perl libfile-desktopentry-perl libfile-mimeinfo-perl libipc-system-simple-perl libnet-dbus-perl libpaper-utils libpaper1 libpcre2-16-0
  libpcre2-32-0 libpcre2-8-0 libpcre2-dev libpcre2-posix0 libreadline-dev libtie-ixhash-perl libx11-protocol-perl libxml-twig-perl libxml-xpathengine-perl r-base-core r-base-dev
  r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme
  r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended x11-xserver-utils xdg-utils
Suggested packages:
  readline-doc libunicode-map8-perl libunicode-string-perl xml-twig-tools elpa-ess r-doc-info | r-doc-pdf r-mathlib texlive-base texlive-latex-base texlive-plain-generic
  texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils texlive-latex-recommended texlive-latex-extra mozilla | www-browser nickle cairo-5c xorg-docs-core
The following NEW packages will be installed:
  bzip2-doc libbz2-dev libfile-basedir-perl libfile-desktopentry-perl libfile-mimeinfo-perl libipc-system-simple-perl libnet-dbus-perl libpaper-utils libpaper1 libpcre2-16-0
  libpcre2-32-0 libpcre2-8-0 libpcre2-dev libpcre2-posix0 libreadline-dev libtie-ixhash-perl libx11-protocol-perl libxml-twig-perl libxml-xpathengine-perl r-base r-base-core
  r-base-dev r-base-html r-cran-boot r-cran-class r-cran-cluster r-cran-codetools r-cran-foreign r-cran-kernsmooth r-cran-lattice r-cran-mass r-cran-matrix r-cran-mgcv r-cran-nlme
  r-cran-nnet r-cran-rpart r-cran-spatial r-cran-survival r-doc-html r-recommended x11-xserver-utils xdg-utils
0 upgraded, 42 newly installed, 0 to remove and 106 not upgraded.
Need to get 50.6 MB of archives.
After this operation, 84.8 MB of additional disk space will be used.
W: Target Packages (Packages) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-amd64) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
W: Target Contents-deb (Contents-all) is configured multiple times in /etc/apt/sources.list:11 and /etc/apt/sources.list:12
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 bzip2-doc all 1.0.6-8.1ubuntu0.2 [294 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 libbz2-dev amd64 1.0.6-8.1ubuntu0.2 [30.0 kB]
Get:3 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-base-core 4.3.3-1.1804.0 [26.9 MB]
Get:4 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libipc-system-simple-perl all 1.25-4 [22.5 kB]
Get:5 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libfile-basedir-perl all 0.07-1 [16.9 kB]
Get:6 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libfile-desktopentry-perl all 0.22-1 [18.2 kB]
Get:7 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libfile-mimeinfo-perl all 0.28-1 [41.4 kB]
Get:8 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libxml-twig-perl all 1:3.50-1 [156 kB]
Get:9 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libnet-dbus-perl amd64 1.1.0-4build2 [176 kB]
Get:10 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libpaper1 amd64 1.1.24+nmu5ubuntu1 [13.6 kB]
Get:11 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libpaper-utils amd64 1.1.24+nmu5ubuntu1 [8,170 B]
Get:12 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libpcre2-16-0 amd64 10.31-2 [169 kB]
Get:13 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libpcre2-32-0 amd64 10.31-2 [160 kB]
Get:14 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libpcre2-8-0 amd64 10.31-2 [179 kB]
Get:15 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libpcre2-posix0 amd64 10.31-2 [5,788 B]
Get:16 http://mirrors.aliyun.com/ubuntu bionic/universe amd64 libpcre2-dev amd64 10.31-2 [627 kB]
Get:17 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libreadline-dev amd64 7.0-3 [133 kB]
Get:18 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-boot 1.3-30-1.1804.0 [620 kB]
Get:19 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libtie-ixhash-perl all 1.23-2 [11.2 kB]
Get:20 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libx11-protocol-perl all 0.56-7 [149 kB]
Get:21 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-cluster 2.1.6-1.1804.0 [554 kB]
Get:22 http://mirrors.aliyun.com/ubuntu bionic/main amd64 libxml-xpathengine-perl all 0.14-1 [31.8 kB]
Get:23 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 xdg-utils all 1.1.2-1ubuntu2.5 [60.4 kB]
Get:24 http://mirrors.aliyun.com/ubuntu bionic/main amd64 x11-xserver-utils amd64 7.7+7build1 [159 kB]
Get:25 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-foreign 0.8.86-1.1804.0 [238 kB]
Get:26 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-kernsmooth 2.23-22-1cran1.1804.0 [90.3 kB]
Get:27 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-lattice 0.22-5-1.1804.0 [1,348 kB]                                                                        
Get:28 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-nlme 3.1.163-1.1804.0 [2,268 kB]                                                                          
Get:29 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-matrix 1.6-5-1.1804.0 [3,765 kB]                                                                          
Get:30 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-mgcv 1.9-1-1.1804.0 [3,180 kB]                                                                            
Get:31 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-rpart 4.1.23-1cran1.1804.0 [683 kB]                                                                       
Get:32 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-survival 3.5-8-1.1804.0 [6,146 kB]                                                                        
Get:33 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-mass 7.3-60-2.1804.0 [1,119 kB]                                                                           
Get:34 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-class 7.3-22-2.1804.0 [88.2 kB]                                                                           
Get:35 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-nnet 7.3-19-2.1804.0 [112 kB]                                                                             
Get:36 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-spatial 7.3-11-2.1804.1 [128 kB]                                                                          
Get:37 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-cran-codetools 0.2-19-1cran1.1804.0 [90.7 kB]                                                                  
Get:38 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-recommended 4.3.3-1.1804.0 [2,784 B]                                                                           
Get:39 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-base 4.3.3-1.1804.0 [46.2 kB]                                                                                  
Get:40 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-base-dev 4.3.3-1.1804.0 [4,512 B]                                                                              
Get:41 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-base-html 4.3.3-1.1804.0 [94.3 kB]                                                                             
Get:42 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran40/ r-doc-html 4.3.3-1.1804.0 [595 kB]                                                                               
Fetched 50.6 MB in 14s (3,688 kB/s)                                                                                                                                                 
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package bzip2-doc.
(Reading database ... 127271 files and directories currently installed.)
Preparing to unpack .../00-bzip2-doc_1.0.6-8.1ubuntu0.2_all.deb ...
Unpacking bzip2-doc (1.0.6-8.1ubuntu0.2) ...
Selecting previously unselected package libbz2-dev:amd64.
Preparing to unpack .../01-libbz2-dev_1.0.6-8.1ubuntu0.2_amd64.deb ...
Unpacking libbz2-dev:amd64 (1.0.6-8.1ubuntu0.2) ...
Selecting previously unselected package libipc-system-simple-perl.
Preparing to unpack .../02-libipc-system-simple-perl_1.25-4_all.deb ...
Unpacking libipc-system-simple-perl (1.25-4) ...
Selecting previously unselected package libfile-basedir-perl.
Preparing to unpack .../03-libfile-basedir-perl_0.07-1_all.deb ...
Unpacking libfile-basedir-perl (0.07-1) ...
Selecting previously unselected package libfile-desktopentry-perl.
Preparing to unpack .../04-libfile-desktopentry-perl_0.22-1_all.deb ...
Unpacking libfile-desktopentry-perl (0.22-1) ...
Selecting previously unselected package libfile-mimeinfo-perl.
Preparing to unpack .../05-libfile-mimeinfo-perl_0.28-1_all.deb ...
Unpacking libfile-mimeinfo-perl (0.28-1) ...
Selecting previously unselected package libxml-twig-perl.
Preparing to unpack .../06-libxml-twig-perl_1%3a3.50-1_all.deb ...
Unpacking libxml-twig-perl (1:3.50-1) ...
Selecting previously unselected package libnet-dbus-perl.
Preparing to unpack .../07-libnet-dbus-perl_1.1.0-4build2_amd64.deb ...
Unpacking libnet-dbus-perl (1.1.0-4build2) ...
Selecting previously unselected package libpaper1:amd64.
Preparing to unpack .../08-libpaper1_1.1.24+nmu5ubuntu1_amd64.deb ...
Unpacking libpaper1:amd64 (1.1.24+nmu5ubuntu1) ...
Selecting previously unselected package libpaper-utils.
Preparing to unpack .../09-libpaper-utils_1.1.24+nmu5ubuntu1_amd64.deb ...
Unpacking libpaper-utils (1.1.24+nmu5ubuntu1) ...
Selecting previously unselected package libpcre2-16-0:amd64.
Preparing to unpack .../10-libpcre2-16-0_10.31-2_amd64.deb ...
Unpacking libpcre2-16-0:amd64 (10.31-2) ...
Selecting previously unselected package libpcre2-32-0:amd64.
Preparing to unpack .../11-libpcre2-32-0_10.31-2_amd64.deb ...
Unpacking libpcre2-32-0:amd64 (10.31-2) ...
Selecting previously unselected package libpcre2-8-0:amd64.
Preparing to unpack .../12-libpcre2-8-0_10.31-2_amd64.deb ...
Unpacking libpcre2-8-0:amd64 (10.31-2) ...
Selecting previously unselected package libpcre2-posix0:amd64.
Preparing to unpack .../13-libpcre2-posix0_10.31-2_amd64.deb ...
Unpacking libpcre2-posix0:amd64 (10.31-2) ...
Selecting previously unselected package libpcre2-dev:amd64.
Preparing to unpack .../14-libpcre2-dev_10.31-2_amd64.deb ...
Unpacking libpcre2-dev:amd64 (10.31-2) ...
Selecting previously unselected package libreadline-dev:amd64.
Preparing to unpack .../15-libreadline-dev_7.0-3_amd64.deb ...
Unpacking libreadline-dev:amd64 (7.0-3) ...
Selecting previously unselected package libtie-ixhash-perl.
Preparing to unpack .../16-libtie-ixhash-perl_1.23-2_all.deb ...
Unpacking libtie-ixhash-perl (1.23-2) ...
Selecting previously unselected package libx11-protocol-perl.
Preparing to unpack .../17-libx11-protocol-perl_0.56-7_all.deb ...
Unpacking libx11-protocol-perl (0.56-7) ...
Selecting previously unselected package libxml-xpathengine-perl.
Preparing to unpack .../18-libxml-xpathengine-perl_0.14-1_all.deb ...
Unpacking libxml-xpathengine-perl (0.14-1) ...
Selecting previously unselected package xdg-utils.
Preparing to unpack .../19-xdg-utils_1.1.2-1ubuntu2.5_all.deb ...
Unpacking xdg-utils (1.1.2-1ubuntu2.5) ...
Selecting previously unselected package r-base-core.
Preparing to unpack .../20-r-base-core_4.3.3-1.1804.0_amd64.deb ...
Unpacking r-base-core (4.3.3-1.1804.0) ...
Selecting previously unselected package r-cran-boot.
Preparing to unpack .../21-r-cran-boot_1.3-30-1.1804.0_all.deb ...
Unpacking r-cran-boot (1.3-30-1.1804.0) ...
Selecting previously unselected package r-cran-cluster.
Preparing to unpack .../22-r-cran-cluster_2.1.6-1.1804.0_amd64.deb ...
Unpacking r-cran-cluster (2.1.6-1.1804.0) ...
Selecting previously unselected package r-cran-foreign.
Preparing to unpack .../23-r-cran-foreign_0.8.86-1.1804.0_amd64.deb ...
Unpacking r-cran-foreign (0.8.86-1.1804.0) ...
Selecting previously unselected package r-cran-kernsmooth.
Preparing to unpack .../24-r-cran-kernsmooth_2.23-22-1cran1.1804.0_amd64.deb ...
Unpacking r-cran-kernsmooth (2.23-22-1cran1.1804.0) ...
Selecting previously unselected package r-cran-lattice.
Preparing to unpack .../25-r-cran-lattice_0.22-5-1.1804.0_amd64.deb ...
Unpacking r-cran-lattice (0.22-5-1.1804.0) ...
Selecting previously unselected package r-cran-nlme.
Preparing to unpack .../26-r-cran-nlme_3.1.163-1.1804.0_amd64.deb ...
Unpacking r-cran-nlme (3.1.163-1.1804.0) ...
Selecting previously unselected package r-cran-matrix.
Preparing to unpack .../27-r-cran-matrix_1.6-5-1.1804.0_amd64.deb ...
Unpacking r-cran-matrix (1.6-5-1.1804.0) ...
Selecting previously unselected package r-cran-mgcv.
Preparing to unpack .../28-r-cran-mgcv_1.9-1-1.1804.0_amd64.deb ...
Unpacking r-cran-mgcv (1.9-1-1.1804.0) ...
Selecting previously unselected package r-cran-rpart.
Preparing to unpack .../29-r-cran-rpart_4.1.23-1cran1.1804.0_amd64.deb ...
Unpacking r-cran-rpart (4.1.23-1cran1.1804.0) ...
Selecting previously unselected package r-cran-survival.
Preparing to unpack .../30-r-cran-survival_3.5-8-1.1804.0_amd64.deb ...
Unpacking r-cran-survival (3.5-8-1.1804.0) ...
Selecting previously unselected package r-cran-mass.
Preparing to unpack .../31-r-cran-mass_7.3-60-2.1804.0_amd64.deb ...
Unpacking r-cran-mass (7.3-60-2.1804.0) ...
Selecting previously unselected package r-cran-class.
Preparing to unpack .../32-r-cran-class_7.3-22-2.1804.0_amd64.deb ...
Unpacking r-cran-class (7.3-22-2.1804.0) ...
Selecting previously unselected package r-cran-nnet.
Preparing to unpack .../33-r-cran-nnet_7.3-19-2.1804.0_amd64.deb ...
Unpacking r-cran-nnet (7.3-19-2.1804.0) ...
Selecting previously unselected package r-cran-spatial.
Preparing to unpack .../34-r-cran-spatial_7.3-11-2.1804.1_amd64.deb ...
Unpacking r-cran-spatial (7.3-11-2.1804.1) ...
Selecting previously unselected package r-cran-codetools.
Preparing to unpack .../35-r-cran-codetools_0.2-19-1cran1.1804.0_all.deb ...
Unpacking r-cran-codetools (0.2-19-1cran1.1804.0) ...
Selecting previously unselected package r-recommended.
Preparing to unpack .../36-r-recommended_4.3.3-1.1804.0_all.deb ...
Unpacking r-recommended (4.3.3-1.1804.0) ...
Selecting previously unselected package r-base.
Preparing to unpack .../37-r-base_4.3.3-1.1804.0_all.deb ...
Unpacking r-base (4.3.3-1.1804.0) ...
Selecting previously unselected package r-base-dev.
Preparing to unpack .../38-r-base-dev_4.3.3-1.1804.0_all.deb ...
Unpacking r-base-dev (4.3.3-1.1804.0) ...
Selecting previously unselected package r-base-html.
Preparing to unpack .../39-r-base-html_4.3.3-1.1804.0_all.deb ...
Unpacking r-base-html (4.3.3-1.1804.0) ...
Selecting previously unselected package r-doc-html.
Preparing to unpack .../40-r-doc-html_4.3.3-1.1804.0_all.deb ...
Unpacking r-doc-html (4.3.3-1.1804.0) ...
Selecting previously unselected package x11-xserver-utils.
Preparing to unpack .../41-x11-xserver-utils_7.7+7build1_amd64.deb ...
Unpacking x11-xserver-utils (7.7+7build1) ...
Setting up libpaper1:amd64 (1.1.24+nmu5ubuntu1) ...

Creating config file /etc/papersize with new version
Setting up r-cran-boot (1.3-30-1.1804.0) ...
Setting up libpaper-utils (1.1.24+nmu5ubuntu1) ...
Setting up libbz2-dev:amd64 (1.0.6-8.1ubuntu0.2) ...
Setting up libxml-twig-perl (1:3.50-1) ...
Setting up libipc-system-simple-perl (1.25-4) ...
Setting up libfile-basedir-perl (0.07-1) ...
Setting up r-cran-lattice (0.22-5-1.1804.0) ...
Setting up r-cran-nlme (3.1.163-1.1804.0) ...
Setting up r-cran-foreign (0.8.86-1.1804.0) ...
Setting up libtie-ixhash-perl (1.23-2) ...
Setting up libnet-dbus-perl (1.1.0-4build2) ...
Setting up libfile-desktopentry-perl (0.22-1) ...
Setting up bzip2-doc (1.0.6-8.1ubuntu0.2) ...
Setting up libreadline-dev:amd64 (7.0-3) ...
Setting up x11-xserver-utils (7.7+7build1) ...
Setting up libx11-protocol-perl (0.56-7) ...
Setting up libxml-xpathengine-perl (0.14-1) ...
Setting up libpcre2-8-0:amd64 (10.31-2) ...
Setting up libpcre2-32-0:amd64 (10.31-2) ...
Setting up xdg-utils (1.1.2-1ubuntu2.5) ...
Setting up libfile-mimeinfo-perl (0.28-1) ...
Setting up libpcre2-16-0:amd64 (10.31-2) ...
Setting up r-cran-cluster (2.1.6-1.1804.0) ...
Setting up r-doc-html (4.3.3-1.1804.0) ...
Setting up r-cran-matrix (1.6-5-1.1804.0) ...
Setting up r-base-core (4.3.3-1.1804.0) ...

Creating config file /etc/R/Renviron with new version
Setting up r-cran-kernsmooth (2.23-22-1cran1.1804.0) ...
Setting up r-cran-nnet (7.3-19-2.1804.0) ...
Setting up r-cran-mgcv (1.9-1-1.1804.0) ...
Setting up r-cran-rpart (4.1.23-1cran1.1804.0) ...
Setting up r-base-html (4.3.3-1.1804.0) ...
Setting up r-cran-spatial (7.3-11-2.1804.1) ...
Setting up libpcre2-posix0:amd64 (10.31-2) ...
Setting up r-cran-mass (7.3-60-2.1804.0) ...
Setting up r-cran-survival (3.5-8-1.1804.0) ...
Setting up r-cran-codetools (0.2-19-1cran1.1804.0) ...
Setting up r-cran-class (7.3-22-2.1804.0) ...
Setting up libpcre2-dev:amd64 (10.31-2) ...
Setting up r-recommended (4.3.3-1.1804.0) ...
Setting up r-base-dev (4.3.3-1.1804.0) ...
Setting up r-base (4.3.3-1.1804.0) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for tex-common (6.09) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.6) ...
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcudadebugger.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcudadebugger.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcudadebugger.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-compiler.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-compiler.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.515.105.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.535.154.05 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.535.129.03 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-pkcs11.so.535.161.07 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcudadebugger.so.525.125.06 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-compiler.so.515.65.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-compiler.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.455.45.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ptxjitcompiler.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-allocator.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-ml.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.460.73.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libcuda.so.455.45.01 is empty, not checked.
/sbin/ldconfig.real: File /usr/lib/x86_64-linux-gnu/libnvidia-cfg.so.460.73.01 is empty, not checked.
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

三、验证是否安装成功

要验证 R 是否成功安装,你可以通过以下步骤在终端中进行验证:

启动 R:在终端中输入以下命令启动 R:

R

检查版本号:一旦 R 启动,你将看到 R 的命令行界面。在命令行界面中,输入以下命令以检查 R 的版本号:

sessionInfo()

这将显示有关你安装的 R 版本的详细信息,包括 R 的版本号、操作系统信息等。

运行简单的 R 命令:你可以尝试运行一些简单的 R 命令来验证 R 是否能够正常工作。例如,你可以尝试计算一些简单的数学运算,如:

2 + 2

如果 R 成功安装并正常工作,你应该会得到正确的结果,即 4。

退出 R:完成验证后,你可以输入以下命令退出 R:
R

quit()

按下回车键即可退出 R。

操作记录:

(tfv1) root@98031e181845:/data/myapp2024/myBigDataApplicationDevelopment# R

R version 4.3.3 (2024-02-29) -- "Angel Food Cake"
Copyright (C) 2024 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.

> sessionInfo()
Warning: Your system is mis-configured: ‘/etc/localtime’ is not a symlink
Warning: It is strongly recommended to set envionment variable TZ to ‘localtime’ (or equivalent)
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3 
LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so;  LAPACK version 3.7.1

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: localtime
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.3.3

以上操作补充说明:已经成功地启动了 R 会话,并且显示了一些有关你系统配置的警告信息。R 提示你的系统时间配置存在问题,并建议你将环境变量 TZ 设置为 ‘localtime’。这可以通过设置环境变量来解决,例如:

export TZ=localtime

你可以将上述命令添加到你的 ~/.bashrc 文件中,以便每次登录时都自动设置。

此外,R 还显示了会话信息,其中包含了 R 的版本信息、操作系统信息、已加载的基础包等。

看起来一切都正常运行,你现在可以开始在 R 中进行编程和数据分析了。如果你有任何进一步的问题或需要帮助,请随时告诉我。

四、安装Rstudio

接下来安装Rstudio:

1)sudo apt-get install gdebi-core

2)wget https://download2.rstudio.org/rstudio-server-1.1.456-amd64.deb

3)sudo gdebi rstudio-server-1.1.456-amd64.deb

4)然后输入http://你的服务器ip:8787进行登录。你的IP地址获取方式:终端输入ifconfig -a命令
5)其中inet:后面即为IP地址。在显示的界面上登录即可。

6)若还有问题sudo rstudio-server verify-installation命令查看。

操作记录:

wget https://download2.rstudio.org/rstudio-server-1.1.456-amd64.deb
--2024-04-18 00:07:51--  https://download2.rstudio.org/rstudio-server-1.1.456-amd64.deb
Resolving download2.rstudio.org (download2.rstudio.org)... 3.164.143.18, 3.164.143.42, 3.164.143.9, ...
Connecting to download2.rstudio.org (download2.rstudio.org)|3.164.143.18|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 63553606 (61M) [application/x-deb]
Saving to: ‘rstudio-server-1.1.456-amd64.deb’

rstudio-server-1.1.456-amd64.deb              100%[==============================================================================================>]  60.61M  6.44MB/s    in 15s     

2024-04-18 00:08:07 (4.09 MB/s) - ‘rstudio-server-1.1.456-amd64.deb’ saved [63553606/63553606]

(tfv1) root@98031e181845:/data/myapp2024/myR# ls
rstudio-server-1.1.456-amd64.deb
(tfv1) root@98031e181845:/data/myapp2024/myR# sudo gdebi rstudio-server-1.1.456-amd64.deb
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done

RStudio Server
 RStudio is a set of integrated tools designed to help you be more productive with R. It includes a console, syntax-highlighting editor that supports direct code execution, as well as tools for plotting, history, and workspace management.
Do you want to install the software package? [y/N]:y
Selecting previously unselected package rstudio-server.
(Reading database ... 130110 files and directories currently installed.)
Preparing to unpack rstudio-server-1.1.456-amd64.deb ...
Unpacking rstudio-server (1.1.456) ...
Setting up rstudio-server (1.1.456) ...
groupadd: group 'rstudio-server' already exists

补充说明ubuntu22.04安装方法:

sudo apt install r-base-core
sudo apt-get install gdebi-core
sudo wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.02.3-492-amd64.deb
sudo gdebi rstudio-server-2022.02.3-492-amd64.deb

登录测试:本机IP:8787

或者127.0.0.1:8787

在这里插入图片描述

五、可视化操作

当你已经成功配置了 RStudio Server 并安装了 R 语言环境后,你可以使用各种 R 语言的数据可视化库来创建图表和可视化效果。下面是一个简单的示例,演示如何使用 ggplot2 包创建一个散点图:

首先,确保你已经安装了 ggplot2 包。如果没有安装,可以使用以下命令在 RStudio 中安装:

install.packages("ggplot2")

创建示例数据集。我们使用内置的 mtcars 数据集,它包含了32种不同汽车的性能数据。

# 加载 mtcars 数据集
data(mtcars)

使用 ggplot2 创建一个散点图。以下是一个简单的示例,绘制了汽车的里程数(mpg)和排气量(disp)之间的关系:

library(ggplot2)
# 创建散点图
ggplot(mtcars, aes(x = mpg, y = disp)) +
  geom_point() +
  labs(title = "汽车里程数与排气量关系", x = "里程数 (mpg)", y = "排气量 (disp)")

这段代码会生成一个散点图,其中 x 轴表示汽车的里程数(mpg),y 轴表示汽车的排气量(disp)。每个点代表一个汽车,其位置由 mpg 和 disp 决定。

在这里插入图片描述

也可以使用:加载一个示例数据集。R 语言内置了一些示例数据集,其中之一是 iris 数据集,包含了鸢尾花的花萼和花瓣的尺寸以及它们的类别。

# 加载 iris 数据集
data(iris)

接下来,让我们使用 ggplot2 包来绘制一个简单的散点图,展示鸢尾花花瓣长度和宽度之间的关系,并根据鸢尾花的种类进行着色。

# 加载 ggplot2 包
library(ggplot2)

# 创建散点图
ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Species)) +
  geom_point() +
  labs(title = "鸢尾花花瓣长度与宽度关系", x = "花瓣长度", y = "花瓣宽度") +
  theme_minimal()

这段代码将创建一个散点图,横坐标为花瓣长度,纵坐标为花瓣宽度,不同种类的鸢尾花将以不同的颜色显示。你可以在 RStudio 中运行这些代码,并观察生成的可视化图形。

在这里插入图片描述

参考:https://www.cnblogs.com/liujiaxin2018/p/16373801.html

参考

https://blog.csdn.net/qq_43126480/article/details/1030579275
https://www.cnblogs.com/djx571/p/9372011.html

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/weixin_41194129/article/details/137894209

智能推荐

使用nginx解决浏览器跨域问题_nginx不停的xhr-程序员宅基地

文章浏览阅读1k次。通过使用ajax方法跨域请求是浏览器所不允许的,浏览器出于安全考虑是禁止的。警告信息如下:不过jQuery对跨域问题也有解决方案,使用jsonp的方式解决,方法如下:$.ajax({ async:false, url: 'http://www.mysite.com/demo.do', // 跨域URL ty..._nginx不停的xhr

在 Oracle 中配置 extproc 以访问 ST_Geometry-程序员宅基地

文章浏览阅读2k次。关于在 Oracle 中配置 extproc 以访问 ST_Geometry,也就是我们所说的 使用空间SQL 的方法,官方文档链接如下。http://desktop.arcgis.com/zh-cn/arcmap/latest/manage-data/gdbs-in-oracle/configure-oracle-extproc.htm其实简单总结一下,主要就分为以下几个步骤。..._extproc

Linux C++ gbk转为utf-8_linux c++ gbk->utf8-程序员宅基地

文章浏览阅读1.5w次。linux下没有上面的两个函数,需要使用函数 mbstowcs和wcstombsmbstowcs将多字节编码转换为宽字节编码wcstombs将宽字节编码转换为多字节编码这两个函数,转换过程中受到系统编码类型的影响,需要通过设置来设定转换前和转换后的编码类型。通过函数setlocale进行系统编码的设置。linux下输入命名locale -a查看系统支持的编码_linux c++ gbk->utf8

IMP-00009: 导出文件异常结束-程序员宅基地

文章浏览阅读750次。今天准备从生产库向测试库进行数据导入,结果在imp导入的时候遇到“ IMP-00009:导出文件异常结束” 错误,google一下,发现可能有如下原因导致imp的数据太大,没有写buffer和commit两个数据库字符集不同从低版本exp的dmp文件,向高版本imp导出的dmp文件出错传输dmp文件时,文件损坏解决办法:imp时指定..._imp-00009导出文件异常结束

python程序员需要深入掌握的技能_Python用数据说明程序员需要掌握的技能-程序员宅基地

文章浏览阅读143次。当下是一个大数据的时代,各个行业都离不开数据的支持。因此,网络爬虫就应运而生。网络爬虫当下最为火热的是Python,Python开发爬虫相对简单,而且功能库相当完善,力压众多开发语言。本次教程我们爬取前程无忧的招聘信息来分析Python程序员需要掌握那些编程技术。首先在谷歌浏览器打开前程无忧的首页,按F12打开浏览器的开发者工具。浏览器开发者工具是用于捕捉网站的请求信息,通过分析请求信息可以了解请..._初级python程序员能力要求

Spring @Service生成bean名称的规则(当类的名字是以两个或以上的大写字母开头的话,bean的名字会与类名保持一致)_@service beanname-程序员宅基地

文章浏览阅读7.6k次,点赞2次,收藏6次。@Service标注的bean,类名:ABDemoService查看源码后发现,原来是经过一个特殊处理:当类的名字是以两个或以上的大写字母开头的话,bean的名字会与类名保持一致public class AnnotationBeanNameGenerator implements BeanNameGenerator { private static final String C..._@service beanname

随便推点

二叉树的各种创建方法_二叉树的建立-程序员宅基地

文章浏览阅读6.9w次,点赞73次,收藏463次。1.前序创建#include&lt;stdio.h&gt;#include&lt;string.h&gt;#include&lt;stdlib.h&gt;#include&lt;malloc.h&gt;#include&lt;iostream&gt;#include&lt;stack&gt;#include&lt;queue&gt;using namespace std;typed_二叉树的建立

解决asp.net导出excel时中文文件名乱码_asp.net utf8 导出中文字符乱码-程序员宅基地

文章浏览阅读7.1k次。在Asp.net上使用Excel导出功能,如果文件名出现中文,便会以乱码视之。 解决方法: fileName = HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);_asp.net utf8 导出中文字符乱码

笔记-编译原理-实验一-词法分析器设计_对pl/0作以下修改扩充。增加单词-程序员宅基地

文章浏览阅读2.1k次,点赞4次,收藏23次。第一次实验 词法分析实验报告设计思想词法分析的主要任务是根据文法的词汇表以及对应约定的编码进行一定的识别,找出文件中所有的合法的单词,并给出一定的信息作为最后的结果,用于后续语法分析程序的使用;本实验针对 PL/0 语言 的文法、词汇表编写一个词法分析程序,对于每个单词根据词汇表输出: (单词种类, 单词的值) 二元对。词汇表:种别编码单词符号助记符0beginb..._对pl/0作以下修改扩充。增加单词

android adb shell 权限,android adb shell权限被拒绝-程序员宅基地

文章浏览阅读773次。我在使用adb.exe时遇到了麻烦.我想使用与bash相同的adb.exe shell提示符,所以我决定更改默认的bash二进制文件(当然二进制文件是交叉编译的,一切都很完美)更改bash二进制文件遵循以下顺序> adb remount> adb push bash / system / bin /> adb shell> cd / system / bin> chm..._adb shell mv 权限

投影仪-相机标定_相机-投影仪标定-程序员宅基地

文章浏览阅读6.8k次,点赞12次,收藏125次。1. 单目相机标定引言相机标定已经研究多年,标定的算法可以分为基于摄影测量的标定和自标定。其中,应用最为广泛的还是张正友标定法。这是一种简单灵活、高鲁棒性、低成本的相机标定算法。仅需要一台相机和一块平面标定板构建相机标定系统,在标定过程中,相机拍摄多个角度下(至少两个角度,推荐10~20个角度)的标定板图像(相机和标定板都可以移动),即可对相机的内外参数进行标定。下面介绍张氏标定法(以下也这么称呼)的原理。原理相机模型和单应矩阵相机标定,就是对相机的内外参数进行计算的过程,从而得到物体到图像的投影_相机-投影仪标定

Wayland架构、渲染、硬件支持-程序员宅基地

文章浏览阅读2.2k次。文章目录Wayland 架构Wayland 渲染Wayland的 硬件支持简 述: 翻译一篇关于和 wayland 有关的技术文章, 其英文标题为Wayland Architecture .Wayland 架构若是想要更好的理解 Wayland 架构及其与 X (X11 or X Window System) 结构;一种很好的方法是将事件从输入设备就开始跟踪, 查看期间所有的屏幕上出现的变化。这就是我们现在对 X 的理解。 内核是从一个输入设备中获取一个事件,并通过 evdev 输入_wayland

推荐文章

热门文章

相关标签