环境:centos 6.3 64bit
1、安装R 环境
http://blog.chinaunix.net/uid-25135004-id-4173752.html
2、安装shiny (两种方法)
1)方法一网络安装
1>R 进入命令行
2>install.packages('shiny')
2)方法二下载相关包,安装
1>下载一下包
http://mirror.bjtu.edu.cn/cran/src/contrib/Rcpp_0.11.1.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/bitops_1.0-6.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/httpuv_1.2.3.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/caTools_1.16.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/RJSONIO_1.0-3.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/xtable_1.7-3.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/digest_0.6.4.tar.gz
http://mirror.bjtu.edu.cn/cran/src/contrib/shiny_0.9.1.tar.gz
2>安装
R CMD INSTALL Rcpp_0.11.1.tar.gz
R CMD INSTALL bitops_1.0-6.tar.gz
R CMD INSTALL httpuv_1.2.3.tar.gz
R CMD INSTALL caTools_1.16.tar.gz
R CMD INSTALL RJSONIO_1.0-3.tar.gz
R CMD INSTALL xtable_1.7-3.tar.gz
R CMD INSTALL digest_0.6.4.tar.gz
R CMD INSTALL shiny_0.9.1.tar.gz
3、验证shinay包是否成功安装(进入R 命令行)
> library("shiny") 无报错
4、下载shiny-server
http://download3.rstudio.org/centos-5.9/x86_64/shiny-server-1.0.0.42-x86_64.rpm
5、安装shiny-server
yum install --nogpgcheck shiny-server-1.0.0.42-x86_64.rpm
6、shiny-server 配置
相关网址:http://rstudio.github.io/shiny-server/latest/
1) 配置文件路径
/opt/shiny-server/config/default.config
2)配置内容
点击(此处)折叠或打开
- # Instruct Shiny Server to run applications as the user "shiny"
- run_as shiny;
- # Define a server that listens on port 3838
- server {
- listen 8080;
- # Define a location at the base URL
- location / {
- # Host the directory of Shiny Apps stored in this directory
- site_dir /export/shiny-server/data;
- # Log all Shiny output to files in this directory
- log_dir /var/log/shiny-server;
- # When a user visits the base URL rather than a particular application,
- # an index of the applications available in this directory will be shown.
- directory_index on;
- }
- }
7、shiny-server 管理
相关网址:http://rstudio.github.io/shiny-server/latest/
1)启动,关闭,重启,查看状态命令
start shiny-server
stop shiny-server
restart shiny-server
status shiny-server
2)不中断服务加载配置
reload shiny-server
8、访问界面 用google浏览器访问 (我们修改端口为8080)