Docker容器嵌入式开发:在Ubuntu上配置RStudio与R语言、可视化操作

目录

  • 一、dirmngr工具
  • 二、R环境安装与配置
  • 三、验证是否安装成功
  • 四、安装Rstudio
  • 五、可视化操作
  • 参考

以上是在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 <marutter@gmail.com>" 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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/556241.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

svn使用(上传自己的项目到svn上)

安卓开发工具版本 创建项目后&#xff0c;首先在.gitgnore文件里面加入你要过滤的文件路径 然后点击VCS——》share Project&#xff0c;然后下一步选择一个svn路径&#xff0c;点击确定后。然后将代码提交。

团体程序设计天梯赛 往年关键真题 详细分析完整AC代码】L2-014 列车调度 STL L2-015 互评成绩 排序

【团体程序设计天梯赛 往年关键真题 详细分析&完整AC代码】搞懂了赛场上拿下就稳 【团体程序设计天梯赛 往年关键真题 25分题合集 详细分析&完整AC代码】&#xff08;L2-001 - L2-024&#xff09;搞懂了赛场上拿下就稳了 【团体程序设计天梯赛 往年关键真题 25分题合…

.NET 爬虫从入门到入狱

目录 前言 1.&#x1f4a1;使用HttpClient爬取数据 2.&#x1f680;模拟User-Agent 3.&#x1f935;使用HTML解析库 3.&#x1f44c;前端Price显示 4.&#x1f331;运行实例 获取金价Au 5.&#x1f9fe;使用正则表达式解析 6.&#x1f4ab;获取BTC价格 7.✨获取CSDN热点…

界面组件Telerik UI for WPF 2024 Q1新版亮点 - 全新DateRangePicker组件

Telerik UI for WPF拥有超过100个控件来创建美观、高性能的桌面应用程序&#xff0c;同时还能快速构建企业级办公WPF应用程序。UI for WPF支持MVVM、触摸等&#xff0c;创建的应用程序可靠且结构良好&#xff0c;非常容易维护&#xff0c;其直观的API将无缝地集成Visual Studio…

解决 vue install 引发的 failed Error: not found: python2 问题

发生 install 异常时&#xff0c;提示信息如下所示&#xff1a; npm ERR! code 1 npm ERR! path U:\cnblogs\fanfengping-dtops\fanfengping-dtops-front\node_modules\node-sass npm ERR! command failed npm ERR! command U:\Windows\system32\cmd.exe /d /s /c node scripts…

公网IP多少钱可以购买?

公网IP是指可以在全球范围内访问和识别的唯一IP地址。对于许多企业和个人用户来说&#xff0c;公网IP是实现远程访问、搭建服务器、建立安全连接等重要需求的基础。公网IP的获取并不是免费的&#xff0c;并且价格因供应商和地区而异。 现有公网IP市场 当前&#xff0c;市场上有…

STM32之不使用MicroLIB

一、microlib介绍 microlib 是缺省 C 库的备选库,功能上不具备某些 ISO C 特性。 microlib 进行了高度优化以使代码变得很小,功能比缺省 C 库少,用于必须在极少量内存环境下运行的深层嵌入式应用程序。 二、不使用microlib的原因 由于microlib不支持C++开发,因此在使用C…

PLC怎么接入互联网

几十年来&#xff0c;PLC都是用于现场设备的自动化控制。随着移动互联网技术的发展&#xff0c;移动办公的便捷性使PLC联网进行远程监控操作的需求越来越多。那PLC怎么接入互联网呢&#xff1f; PLC的通讯基本都是基于现场的通讯&#xff0c;无论是RS485,RS232还是 TCP协议&am…

传统外呼吃力不讨好?AI智能外呼降低85%人力成本!

前几天有电商的客户来咨询&#xff0c;他们每逢大促客服压力就激增&#xff0c;主要原因就是客服人员少&#xff0c;遇到这种高峰期根本来不及打电话&#xff0c;招新人的话培训时间长&#xff0c;算下来人力成本相当高。因此他们想借助智能外呼看能否解决这个难题。这种时候就…

【3GPP】【核心网】【LTE】史上最全 闲时被叫CSFB 深度分析

3.2 闲时被叫CSFB 3.2.1 闲时被叫CSFB基本流程 被叫CSFB消息附近通常有一条Paging寻呼&#xff0c;然后进行CSFB流程&#xff1a; &#xff08;1&#xff09;UE向MME发起拓展服务请求&#xff0c;同时上报TMSI和承载状态&#xff0c;该条消息的服务类型字段中会区分主/被叫&a…

风险解码:数字技术如何重塑风控游戏规则?

“IT有得聊”是机械工业出版社旗下IT专业资讯和服务平台&#xff0c;致力于帮助读者在广义的IT领域里&#xff0c;掌握更专业、更实用的知识与技能&#xff0c;快速提升职场竞争力。 点击蓝色微信名可快速关注我们&#xff01; 数字风控概述 从2007年开始到2014年左右&#xf…

【GoWeb框架初探————Gin篇】

1. Gin 1.1 下载相应依赖 创建go项目&#xff0c;在项目下建立go.mod文件&#xff08;若有则跳过&#xff09; 命令行运行 go get github.com/gin-gonic/gin1.2 启动一个简单Web服务 package mainimport ("github.com/gin-gonic/gin""github.com/thinkerou/…

️️️Vue3+Element-Plus二次封装一个可定制化的table组件

前言 为什么需要二次封装 开发后台管理系统,会接触到很多表格和表单,一但表格表单多起来,仅仅只需要一小部分改变&#xff0c;都需要在中重写一大堆代码,许多重复逻辑,我们可以把重复逻辑抽离出来二次封装一个组件 使用,减少在开发中需要编写的代码。 为什么需要定制化 每个…

Springboot Gateway 报错Failed to resolve “bogon”的原因及解决办法

一、问题出现原因及初步分析 今天遇到一个奇怪的错误&#xff0c;一个一直正确运行的微服务后台&#xff0c;突然无法访问&#xff0c;如何重启都会报错。 想到近期有人在服务器上安装过其它服务&#xff0c;因此&#xff0c;考虑可能是配置问题&#xff0c;可配置问题修复后…

Ubuntu 传输文件

scp [选项] 源文件 目标路径 以下是一些常用的 scp 命令选项&#xff1a; -r&#xff1a;递归复制目录和子目录。 -P&#xff1a;指定远程 SSH 服务器的端口号。 -i&#xff1a;指定用于身份验证的私钥文件。 -p&#xff1a;保留源文件的时间戳、权限和所有者。 -v&#x…

从D盘调整空间增加到C盘而不丢失数据的3 种方法

越来越多的Windows 10笔记本电脑和台式机使用SSD作为系统盘&#xff0c;这对于提高计算机性能很有用&#xff0c;因为SSD的读写速度要快得多。但另一方面&#xff0c;SSD价格更高&#xff0c;因此比传统机械硬盘体积更小。当然C盘空间不足的可能性更大。在这种情况下&#xff0…

Java学习笔记零基础入门1

目录 第一章 Java概述 1.1 什么是程序 1.2 Java 技术体系平台 1.3 Java 重要特点 1.4 Java 的开发工具 4.1 工具选择 1.5 Java 运行机制及运行过程 5.1 Java 语言的特点&#xff1a;跨平台性 5.2 Java 核心机制-Java 虚拟机 [JVMjavavirtual machine] 1.6 什么是JDK&…

K8s 部署 elasticsearch-7.14.0 集群 及 kibana 客户端

一、K8s 部署 elasticsearch-7.14.0 集群 安装规划 组件replicas类型es3StatefulSetkibana1Deployment 使用 k8s 版本为&#xff1a;v1.18.0 。 本次使用 OpenEBS 来作为存储引擎&#xff0c;OpenEBS 是一个开源的、可扩展的存储平台&#xff0c;它提供了一种简单的方式来创…

HQL,SQL刷题,尚硅谷(中级)

目录 相关表结构&#xff1a; 1、order_info表 2、order_detail表 题目及思路解析&#xff1a; 第一题&#xff0c;查询各品类销售商品的种类数及销量最高的商品 第二题 查询用户的累计消费金额及VIP等级 第三题 查询首次下单后第二天连续下单的用户比率 总结归纳&#xff1a…

2024.4.18

学生管理部分 #include<myhead.h> int main(int argc, char *argv[]) {sqlite3* ppDbNULL;if(sqlite3_open("./mydb.db",&ppDb)!SQLITE_OK){printf("sqlite3_open error:%s\n",sqlite3_errmsg(ppDb));return -1;}//创建数据表char arg[128]&quo…