阿里云上部署Rstudio Server以及Shiny Server

xiaoxiao2021-02-28  49

Rstudio Server

根据rstudio官网的步骤进行部署我的系统是Ubuntu 16.04,因此选ubuntu,其中要选择32位还是64位的时候,可以在自己的服务器键入下面的命令查看自己的系统架构

uname -a

部署完之后创一个非root账号

useradd your_account -m -s /bin/bash sudo passwd linc your_password

然后在浏览器上键入 http://你的服务器IP(或域名):8787 (别忘了防火墙规则中要添加这个端口!)这样就能进到Rstudio Server登录界面,输入your_account 和 your_password就能进入rstudio界面了

Shiny Server

根据rstudio官网的步骤进行部署下载安装完之后在浏览器上键入 http://你的服务器IP(或域名):3838 就能见到shiny默认的页面

如果出现例如右下方的rmarkdown出错的问题一般是你还没安装rmarkdown的库。这时候可以在你的服务器键入R进入R环境,然后键入下面的命令进行安装

install.packages(‘rmarkdown’)

关于shiny的开发参考这个中文教程,部署的话就参考这个默认页面,在我的服务器中它位于

root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples# ls sample-apps welcome.html root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples# cd sample-apps root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples/sample-apps# ls hello rmd root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples/sample-apps# ls hello rmd root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples/sample-apps# cd hello root@iZwz9j6pai60d3814fm8ptZ:/opt/shiny-server/samples/sample-apps/hello# ls server.R ui.R

其中html页面就是welcome.html,shinyApp由两个R文件(server.R ui.R)定义在hello文件夹,然后welcome.html对其进行引用

<iframe src="./sample-apps/hello/" style="border: 1px solid #AAA; width: 290px; height: 460px"></iframe> <div class="caption"> When Shiny is properly configured on your server, you'll see a Shiny app above. </div> <iframe src="./sample-apps/rmd/" style="border: 1px solid #AAA; width: 290px; height: 420px"></iframe> <div class="caption"> With Shiny and <code>rmarkdown</code> installed, you should see a Shiny doc above. </div>
转载请注明原文地址: https://www.6miu.com/read-2626037.html

最新回复(0)