Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂]

(41) 2023-08-01 12:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂],希望能够帮助你!!!。

R官网:https://www.r-project.org/

RStudio:https://www.rstudio.com/

环境:windows11子系统(Ubuntu)

R安装

添加R下载源

# update indices
sudo apt update -qq
# install two helper packages we need
sudo apt install --no-install-recommends software-properties-common dirmngr
# add the signing key (by Michael Rutter) for these repos
# To verify key, run gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc 
# Fingerprint: E298A3A825C0D65DFD57CBB651716619E084DAB9
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
# add the R 4.0 repo from CRAN -- adjust 'focal' to 'groovy' or 'bionic' as needed
sudo add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"

执行安装命令

sudo apt install --no-install-recommends r-base

输入R命令出现如下输出表示R安装成功

root@DKQNI3:~# R

R version 4.1.2 (2021-11-01) -- "Bird Hippie"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R是自由软件,不带任何担保。
在某些条件下你可以将其自由散布。
用'license()'或'licence()'来看散布的详细条件。

R是个合作计划,有许多人为之做出了贡献.
用'contributors()'来看合作者的详细情况
用'citation()'会告诉你如何在出版物中正确地引用R或R程序包。

用'demo()'来看一些示范程序,用'help()'来阅读在线帮助文件,或
用'help.start()'通过HTML浏览器来看帮助文件。
用'q()'退出R.

> 

安装RStudio Server

下载安装包

https://www.rstudio.com/products/rstudio/download-server/

Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂]_https://bianchenghao6.com/blog__第1张

Download RStudio Server v2022.07.1+554

https://www.rstudio.com/products/rstudio/download-server/debian-ubuntu/

Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂]_https://bianchenghao6.com/blog__第2张

Install for Debian 10 / Ubuntu 18 / Ubuntu 20

sudo apt-get install gdebi-core
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.07.1-554-amd64.deb
sudo gdebi rstudio-server-2022.07.1-554-amd64.deb


  • apt-get install安装gdebi-core包:
sudo apt-get install gdebi-core
  • wget下载rstudio-server安装包:
wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2022.07.1-554-amd64.deb
  • 使用gdebi安装rstudio-server:
sudo gdebi rstudio-server-2022.07.1-554-amd64.deb

创建Ubuntu用户

默认不允许root用户登录rstudio-server

创建用户命令

  • useradd username不会在/home下建立一个文件夹username
  • adduser username会在/home下建立一个文件夹username
  • useradd -m username跟adduser一样,可以建立一个文件夹username
useradd -m username
# username为创建的用户名,用于rstudio-server登录

修改用户密码命令

passwd username
# 输入两遍密码即可

启动rstudio-server

rstudio-server start
或重启
rstudio-server restart

使用rstudio-server

打开浏览器输入地址:http://127.0.0.2:8787

Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂]_https://bianchenghao6.com/blog__第3张

127.0.0.1:8787

输入创建的Ubuntu用户名和密码登录

Ubuntu子系统安装R与RStudio Server过程记录[通俗易懂]_https://bianchenghao6.com/blog__第4张

rstudio-server

上一篇

已是最后文章

下一篇

已是最新文章

发表回复