Ubuntu18.04安装最新R3.6+Rstudio-Server并使用Nginx开启SSL加密

文章目录[隐藏]

前言

实在受不了国内容器云的访问速度,于是在德国节点打算新建一个Rstudio服务器自用。之前尝试用CentOS8,发现自己常用的地理信息包GDAL无法支持,因此还是换用Ubuntu18.04。

安装R的依赖环境

由于Ubuntu自带的源R版本更新太慢了,所以这里用rstudio的源



sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

sudo add-apt-repository 'deb [arch=amd64,i386] https://cran.rstudio.com/bin/linux/ubuntu xenial/'

sudo apt-get update

sudo apt-get install r-base

如果还是安装的旧版本R

将deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/加入到/etc/apt/sources.list中,然后再更新apt

安装Rstudio

在官网下载最新版本的RstudioServer安装包:https://rstudio.com/products/rstudio/download-server/debian-ubuntu/
其中CentOS8和之前发行版本的不同,要注意下:



sudo apt-get install gdebi-core -y

wget https://download2.rstudio.org/server/bionic/amd64/rstudio-server-1.2.5033-amd64.deb

sudo gdebi rstudio-server-1.2.5033-amd64.deb

然后重启Rstudio-Server并设置开机启动:



systemctl restart rstudio-server

systemctl enable rstudio-server

此时应该可以在http://IP:8787访问Rstudio网页了



[root@rstudio ~]# lsof -i:8787

COMMAND  PID           USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME

rserver 5579 rstudio-server    6u  IPv4 2446597      0t0  TCP *:msgsrvr (LISTEN)

另外不要忘记新建用户和设置密码:



root@rstudio:~# useradd -d /home/liujason liujason

root@rstudio:~# passwd liujason

Enter new UNIX password: 

Retype new UNIX password: 

passwd: password updated successfully

使用Nginx转发实现SSL加密

Rstudio和Shiny都是需要使用到WebSocket的,因此需要在nginx里开启这个模块,具体可以参考:
https://www.liujason.com/article/529.html


This article is under CC BY-NC-SA 4.0 license.
Please quote the original link:https://www.liujason.com/article/535.html
comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy