shiny server是一种可用把R 语言以web形式展示的服务
环境: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)配置内容

点击(此处)折叠或打开

  1. # Instruct Shiny Server to run applications as the user "shiny"
  2. run_as shiny;
  3. # Define a server that listens on port 3838
  4. server {
  5. listen 8080;
  6. # Define a location at the base URL
  7. location / {
  8. # Host the directory of Shiny Apps stored in this directory
  9. site_dir /export/shiny-server/data;
  10. # Log all Shiny output to files in this directory
  11. log_dir /var/log/shiny-server;
  12. # When a user visits the base URL rather than a particular application,
  13. # an index of the applications available in this directory will be shown.
  14. directory_index on;
  15. }
  16. }

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)
shiny server安装 配置 管理-LMLPHP



12-09 09:32
查看更多