ubuntu 安装 rstudioserver

1、内核版本

root@ubuntu01:/home# hostnamectl
   Static hostname: ubuntu01
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f3145548a2fe40f2a4a23301fc7493a5
           Boot ID: 7864dd7bd14944ffa643fd5d3dfca12e
    Virtualization: vmware
  Operating System: Ubuntu 20.04.3 LTS
            Kernel: Linux 5.11.0-37-generic
      Architecture: x86-64

2、安装R及rstudio

step1、

root@ubuntu01:/home# sudo apt-get install r-base -y  //有rroot权限,sudo可省略
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binutils binutils-common binutils-x86-64-linux-gnu build-essential bzip2-doc dpkg-dev fakeroot g++ g++-9 gcc gcc-9 gfortran
  gfortran-9 icu-devtools libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan5 libatomic1 libbinutils
  libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev libcrypt-dev libctf-nobfd0 libctf0 libfakeroot libgcc-9-dev
…………
Setting up r-base-dev (3.6.3-2) ...
Setting up r-base (3.6.3-2) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for install-info (6.7.0.dfsg.2-5) ...

step2、

root@ubuntu01:/home# sudo apt-get install gdebi-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  gdebi-core
0 upgraded, 1 newly installed, 0 to remove and 92 not upgraded.
Need to get 116 kB of archives.
After this operation, 876 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu focal/universe amd64 gdebi-core all 0.9.5.7+nmu3 [116 kB]
Fetched 116 kB in 6s (21.1 kB/s)
Selecting previously unselected package gdebi-core.
(Reading database ... 197320 files and directories currently installed.)
Preparing to unpack .../gdebi-core_0.9.5.7+nmu3_all.deb ...
Unpacking gdebi-core (0.9.5.7+nmu3) ...
Setting up gdebi-core (0.9.5.7+nmu3) ...
Processing triggers for man-db (2.9.1-1) ...

step3、

root@ubuntu01:/home/software# wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-2021.09.0-351-amd64.deb
root@ubuntu01:/home/software# ls
rstudio-server-2021.09.0-351-amd64.deb

step4、

root@ubuntu01:/home/software# ls
rstudio-server-2021.09.0-351-amd64.deb
root@ubuntu01:/home/software# sudo gdebi rstudio-server-2021.09.0-351-amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reading state information... Done
…………
● rstudio-server.service - RStudio Server
     Loaded: loaded (/lib/systemd/system/rstudio-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-10-15 17:49:23 CST; 1s ago
    Process: 10471 ExecStart=/usr/lib/rstudio-server/bin/rserver (code=exited, status=0/SUCCESS)
   Main PID: 10472 (rserver)
      Tasks: 3 (limit: 2273)
     Memory: 16.8M
     CGroup: /system.slice/rstudio-server.service
             └─10472 /usr/lib/rstudio-server/bin/rserver

10月 15 17:49:22 ubuntu01 systemd[1]: Starting RStudio Server...
10月 15 17:49:23 ubuntu01 systemd[1]: Started RStudio Server.

3、开启8787端口

root@ubuntu01:/home/software# sudo apt-get update
root@ubuntu01:/home/software# sudo apt-get install iptables
root@ubuntu01:/home/software# sudo apt-get install iptables-persistent
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  netfilter-persistent
…………
Setting up iptables-persistent (1.0.14) ...
update-alternatives: using /lib/systemd/system/netfilter-persistent.service to provide /lib/systemd/system/iptables.service (iptables.service) in auto mode
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for systemd (245.4-4ubuntu3.11) ...

出现如下图形页面点yes。

root@ubuntu01:/home/software# iptables -I INPUT -p tcp --dport 8787 -j ACCEPT
root@ubuntu01:/home/software# iptables -I OUTPUT -p udp --dport 8787 -j ACCEPT
root@ubuntu01:/home/software# sudo netfilter-persistent save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/15-ip4tables save
run-parts: executing /usr/share/netfilter-persistent/plugins.d/25-ip6tables save

重启服务

root@ubuntu01:/home/software# sudo rstudio-server restart

4、登录测试,登录方式在网页地址栏输入: IP地址:8787,  如192.168.65.135:8787,   192.168.65.135改为实际使用IP即可。

参考:https://mp.weixin.qq.com/s?__biz=MzUzMTEwODk0Ng==&mid=2247500005&idx=1&sn=ce2e35a54bfea120fc8710f1118f9b3a&chksm=fa4505d8cd328cce95e009d8d5610f010a4dbe6f76c85b3d3c5169ac1ae6f59dffd64de74d36&mpshare=1&scene=23&srcid=1013SFzD3zsaSWPhTw5oVeeC&sharer_sharetime=1634138332834&sharer_shareid=4ed060cc4cd1efce40e3ab6dd8d8c7d4#rd

原文地址:https://www.cnblogs.com/liujiaxin2018/p/15412132.html