文章目录

  • Shiny-Server
    • 安装
      • Ubuntu
      • RedHat/CentOS
    • shiny-server的启动和停止
    • Shiny-Server管理
      • 谁来运行shiny App
      • shiny App运行所需的R包
      • 设置端口号
      • Location

Shiny-Server

Shiny server 可以在线发布shiny应用程序并让用户可以在线管理自己的shiny应用程序。
Shiny Server运行各种不同的shiny程序,

Shiny Server can manage R processes running various Shiny applications over different URLs and ports. Using Shiny Server offers a variety of benefits over simply running Shiny in R directly. These features allow the administrator to:

  • 可以同步进行多个应用程序,每一个应用程序都有自己的链接。
  • 确保系统用户可以自己开发并管理他们的shiny应用程序。
  • 确保当R进程出现问题后可以为下一个用户访问时自动重启。

详细的shiny-server教程可以查看 https://docs.rstudio.com/shiny-server/

安装

Ubuntu

# install R
sudo apt-get install r-base# install shiny
sudo su - \
-c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""# download and install
sudo apt-get install gdebi-core
wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.17.973-amd64.deb
sudo gdebi shiny-server-1.5.17.973-amd64.deb

RedHat/CentOS

# install R
sudo yum install R# install shiny
sudo su - \
-c "R -e \"install.packages('shiny', repos='https://cran.rstudio.com/')\""# download
wget https://download3.rstudio.org/centos7/x86_64/shiny-server-1.5.17.973-x86_64.rpm# install
sudo yum install --nogpgcheck shiny-server-1.5.17.973-x86_64.rpm

详细可以查看https://www.rstudio.com/products/shiny/download-server/redhat-centos/

shiny-server的启动和停止

# 启动 shiny-server
sudo systemctl start shiny-server# 停止 shiny-server
sudo systemctl stop shiny-server# 重启 shiny-server
sudo systemctl restart shiny-server# 检查 shiny-server 的状态
sudo systemctl status shiny-server# 启动 shiny-server
sudo systemctl enable shiny-server# 停止运行 shiny-server
sudo systemctl disable shiny-server

Shiny-Server管理

实际上来说,shiny-server的管理都在其配置文件上,默认情况下,它的配置文件是在/etc/shiny-server/shiny-server.conf. 一般的shiny-server的配置文件内容如下:

# Define the user we should use when spawning R Shiny processes
# 设置运行R shiny 进程的user是谁
run_as shiny;# Define a top-level server which will listen on a port
# 定义服务器的监听端口
server {# Instruct this server to listen on port 3838# shiny-server的监听端口为3838listen 3838;# Define the location available at the base URL# 定义可以使用的基本URL链接location / {#### PRO ONLY ##### Only up tp 20 connections per Shiny process and at most 3 Shiny processes# per application. Proactively spawn a new process when our processes reach # 90% capacity.# 此处的设置是指可以同时有20个连接进行shiny的运行进程,最多每个应用程序有3个连接进程可以同时进行。# 进程最多达到的90%的内存。utilization_scheduler 20 .9 3;#### END PRO ONLY ##### Run this location in 'site_dir' mode, which hosts the entire directory# tree at '/srv/shiny-server'# 使用'site_dir'的话,对应的主目录是/srv/shiny-server# 把应用程序放置在这个指定的目录下,即可运行。(记得提前安装好需要的R包)site_dir /srv/shiny-server;# Define where we should put the log files for this location# 指定日志存放的位置在/var/log/shiny-serverlog_dir /var/log/shiny-server;# Should we list the contents of a (non-Shiny-App) directory when the user # visits the corresponding URL?# 当用户访问相关的URL链接时,是否显示当前目录下的内容directory_index on;}
}# Setup a flat-file authentication system. {.pro}
# 设置平面文件身份验证系统,只有pro的shiny-server才可以运行。auth_passwd_file /etc/shiny-server/passwd;# Define a default admin interface to be run on port 4151. {.pro}
admin 4151 {# Only permit the user named `admin` to access the admin interface.required_user admin;
}

谁来运行shiny App

默认情况下,shiny的应用程序的运行是 shiny用户,它在安装shiny-server时就已经被创建了。
如果需要指定其他用户来运行的话,需要run_as来设置一下。

location / {run_as tim;
}

还需要注意的是改变运行程序的用户后,程序所在的位置也应该能够被这个用户相应的权限才可以。

shiny App运行所需的R包

如果是使用shiny用户来运行你的shiny程序的话,你需要使用shiny用户来安装R包,毕竟在此处总会涉及到权限的问题。
我自己测试过,使用shiny作为运行用户,可以在root环境下安装R包,这样shiny程序仍然是可以运行的。

设置端口号

默认端口号是3838。下面的例子是在配置文件中设置端口号80

server {listen 80;
}

Location

Location的指令定义了shiny应用程序的存放位置以及所使用的URL链接。
比如,以下是定义了访问 http://localhost:3838/specialApp可以访问到存放在/srv/shiny-server/myApp的shiny应用程序。

server {...# Define the location '/specialApp'# 设置访问链接是/specialApplocation /specialApp {# Run this location in 'app_dir' mode, which will host a single Shiny# Application available at '/srv/shiny-server/myApp'# 使用`app_dir`,指定其shiny应用程序的存放位置app_dir /srv/shiny-server/myApp;}# Define the location '/otherApps'location /otherApps {# Run this location in 'site_dir' mode, which hosts the entire directory# tree at '/srv/shiny-server/apps'# 使用site_dir模式,可以将shiny程序放在这个指定的/srv/shiny-server/apps文件夹下,# 访问的链接也会根据文件的路径来自动生成相应的URL链接site_dir /srv/shiny-server/apps;}
...
}

更新时间:2021-10-29

Shiny-Server的安装和使用教程相关推荐

  1. SAP ECC 6.0 ,R3 windows server 2003 安装分享 自学教程

    最近测试了SAP ECC 6.0 windows 下安装,  windows server 2003 +oralce 10g, 总体感觉比R3 要进步了. 运行速度方面也很快,不过我最喜欢的是 ECC ...

  2. SQL Server 2019 安装和配置教程

    一.安装SQL Server 安装地址:https://www.microsoft.com/zh-cn/sql-server/sql-server-downloads 点击如图中的免费试用 点击继续 ...

  3. kangle web server源代码安装简明教程

    kangle web server源代码安装简明教程 - kangle使用交流 - kangle软件 是一款高性能web服务器,反向代理服务器,提供虚拟主机管理系统及代理服务器,web服务器架设 - ...

  4. sql server 2014安装方法教程

    sql server 2014安装方法教程 下载相应的iso镜像包,大概4G左右, 装载一下, 双击setup.exe; 一直下一步下一步, 偶尔步骤要点击一下 ,截图如下 全局规则,我选择全选,所有 ...

  5. 乌班图mysql8.0安装第一次手工启动_Ubuntu Server 16.04下mysql8.0安装配置图文教程

    Ubuntu Server 16.04下mysql8.0安装配置图文教程 1.从Mysql官网上下载安装文件.有两种方式可供选择: 使用APT安装方式安装 使用完整的安装包进行安装 sudo dpkg ...

  6. SQL Server 2019安装教程(图文)

    本章教程,介绍一下SQL Server 2019的安装过程. SQL Server 是Microsoft 公司推出的关系型数据库管理系统.具有使用方便可伸缩性好与相关软件集成程度高等优点.Micros ...

  7. Windows Server 2019安装OpenSSH Server简明教程

    MS酋长之前已经介绍过Windows10已原生支持OpenSSH远程管理功能,那么作为服务器专用的Windows Server 2019更少不了要内置OpenSSH Server组件了.只不过Open ...

  8. Windows Server 2008 安装教程——图文小白版(附下载地址)

    Windows Server 2008 安装教程--图文小白版 目录 下载链接 创建虚拟机 下载链接 链接:https://pan.baidu.com/s/1hoWZicYZqvQmoWtkGh_EN ...

  9. winmail邮箱服务器怎么看,Winmail Mail Server邮件服务器软件怎么使用?Winmail Mail Server安装以及使用教程详...

    选择右边的添加按钮,添加一个index以".php"为扩展名的访问格式也就是动态访问模块. 配置完成之后是进行邮箱网站的验证. 现在还没有安装DNS,可以先使用IP地址进行访问验证 ...

  10. SQL Server 下载安装教程

    --------------------------2021.3.9更新---------------------------------------- 有几位读者私聊我遇到了如下问题 针对如上问题& ...

最新文章

  1. 对RTMP视频流进行BitmapData.draw()出错的解决办法
  2. 如何避免fstab挂载故障问题
  3. 2016\Province_C_C++_C\1 报纸页数
  4. Java 7:使用NIO.2进行文件过滤-第1部分
  5. knockout+echarts实现图表展示
  6. [ES6] 细化ES6之 -- 前端模块化
  7. app个人健康管理系统开源_开源会促进心理健康吗?
  8. 二分图匹配(Luogu3386)
  9. 【Linux使用】Centos 7安装图形界面/切换文本界面与图形界面
  10. 怎样通过Java程序提交yarn的mapreduce计算任务
  11. Tomcat 指定jdk
  12. 18.高性能MySQL --- 大文件传输
  13. 2022年金融与互联网资质牌照研究报告
  14. 北京思科CCIE认证靠谱的机构 网络工程师 -ie-lab网络实验室
  15. 深度:那些梦碎乐视的造车高人!
  16. 使用Android studio 开发xposed插件
  17. lisp 阿基米德螺旋_用CAD如何画阿基米德螺旋线
  18. M301H,M301A,CM201系列盒子刷机
  19. 基于DSP的真空断路器机械特性测试系统硬件设计
  20. 数学速算法_小学数学速算法,掌握了至少提高20分!

热门文章

  1. 竹笛的分类有哪些?来认识竹笛的大家族。
  2. ActiveMQ源码解析(三)Failover机制
  3. u盘插入计算机显示被写保护,磁盘提示被写保护怎么办?
  4. 微软SQL Server BI认证专家QQ群36882826
  5. linux 内核出现 oops 如何调试
  6. C++面向对象程序设计(侯捷)笔记
  7. 华为惠普入局挑战思科 中国企业网络市场混战
  8. python小练习(杂七杂八)
  9. 关于深度学习神经网络模型训练,参数过大,导致显卡内存溢出问题的总结
  10. 巨杉数据库SCDP认证考试答案