1. shiny server簡介mysql
shiny-server是一種可用把R 語言以web形式展現的服務,其實RStudio公司本身構建了R Shiny Application運行的平臺(http://www.shinyapps.io/ ), 用戶能夠經過RStudio上面的工具把本身編寫調試好的Shiny Application上傳到shinyapps.io上去(這裏須要先註冊和設置些東西)。這樣構建了一個雲端的服務器。可是有時仍是有必要本身去構建一個本身的Shiny 服務器,這樣操做起來仍是方便些。下面就講講如何在本身的服務器上構建Shiny Server。linux
環境:ubuntu14.04web
下載:shiny-server的地址redis
因爲ubuntu默認是不支持png 以及X11(redhat,centos也會有一樣的問題)sql
因此安裝R語言前須要安裝libpng,x11相關包,命令以下shell
bonnie@bonnie0:~$ sudo apt-get install build-essential gcc g++ autoconf libiconv-hook-dev libmcrypt-dev libxml2-dev libmysqlclient-dev libcurl4-openssl-dev libjpeg8-dev libpng12-dev libfreetype6-dev
bonnie@bonnie0:~$ sudo apt-get install libX11-dev libXext-dev libXtst-dev libXrender-dev libxmu-dev libxmuu-devubuntu
bonnie@bonnie0:~$ sudo apt-get install r-base
centos
在命令行輸入R進入R語言shell服務器
bonnie@bonnie0: Rapp
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> capabilities()
jpeg png tiff tcltk X11 aqua http/ftp sockets
TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE
libxml fifo cledit iconv NLS profmem cairo
TRUE TRUE TRUE TRUE TRUE TRUE TRUE
PS:若是你不是在ubuntu本機操做登錄,而是遠程經過ssh登陸時,ssh username@ip地址 要加 -X, 不然X11會顯示FALSE
在R命令行中運行 install.packages("shiny")
> install.packages("shiny")
運行成功後(ctl + C)退出R界面
bonnie@bonnie0:~$ sudo apt-get install gdebi-core
bonnie@bonnie0:~$ wget https://download2.rstudio.org/rstudio-server-1.0.44-amd64.deb
bonnie@bonnie0:~$ sudo gdebi rstudio-server-1.0.44-amd64.deb
2.5 登錄web界面查看運行狀況
http://10.211.55.16:3838/ 默認端口時3838,能夠在配置文件(/etc/shiny-server/shiny-server.conf)中修改