Welcome!
According to my first post and as promised, here is my first tutorial, from which you will learn how to install and run smoothly R Shiny Server on the Raspberry Pi 3 - $50 mini computer. If you use R-programming, you probably know Shiny package.
Shiny is an R package that makes it easy to build interactive web apps straight from R. You can host standalone apps on a webpage or embed them in R Markdown documents or build dashboards. You can also extend your Shiny apps with CSS themes, htmlwidgets, and JavaScript actions.
Dashboards Examples:
Charts Examples:
Tutorial
How to install and run Shiny Server on the Raspberry Pi 3 with fresh Raspbian Jessie Lite?
First, update and upgrade:
sudo apt-get update && sudo apt-get upgrade -y
Install base R:
sudo apt-get install r-base r-base-core r-base-dev
Check if R is installed properly:
R
q()
Just run R and quit.
Download and install dependent packages directly from the cran repo.
Look for: Rcpp, httpuv, mime, jsonlite, digest, htmltools, xtable, R6, Cairo, sourcetools, shiny. You can check and download actual versions of this packages here: https://cran.r-project.org/src/contrib/
Below links to the the latest versions of the above packages (at the moment 2018-01-27):
wget https://cran.r-project.org/src/contrib/Rcpp_0.12.15.tar.gz
wget https://cran.r-project.org/src/contrib/httpuv_1.3.5.tar.gz
wget https://cran.r-project.org/src/contrib/mime_0.5.tar.gz
wget https://cran.r-project.org/src/contrib/jsonlite_1.5.tar.gz
wget https://cran.r-project.org/src/contrib/digest_0.6.14.tar.gz
wget https://cran.r-project.org/src/contrib/htmltools_0.3.6.tar.gz
wget https://cran.r-project.org/src/contrib/xtable_1.8-2.tar.gz
wget https://cran.r-project.org/src/contrib/R6_2.2.2.tar.gz
wget https://cran.r-project.org/src/contrib/Cairo_1.5-9.tar.gz
wget https://cran.r-project.org/src/contrib/sourcetools_0.1.6.tar.gz
wget https://cran.r-project.org/src/contrib/shiny_1.0.5.tar.gz
Install downloaded packages with this method which is faster and less memory demanding than install.packages() in R:
sudo R CMD INSTALL Rcpp_0.12.15.tar.gz
sudo R CMD INSTALL httpuv_1.3.5.tar.gz
sudo R CMD INSTALL mime_0.5.tar.gz
sudo R CMD INSTALL jsonlite_1.5.tar.gz
sudo R CMD INSTALL digest_0.6.14.tar.gz
sudo R CMD INSTALL htmltools_0.3.6.tar.gz
sudo R CMD INSTALL xtable_1.8-2.tar.gz
sudo R CMD INSTALL R6_2.2.2.tar.gz
sudo R CMD INSTALL Cairo_1.5-9.tar.gz
sudo R CMD INSTALL sourcetools_0.1.6.tar.gz
sudo R CMD INSTALL shiny_1.0.5.tar.gz
Run that, but remember to check the files versions.
Check if Shiny package is installed:
R
library(shiny)
q()
Just run R, load Shiny library and quit.
Now download, extract and install CMake:
wget https://cmake.org/files/v3.10/cmake-3.10.2.tar.gz
tar xzf cmake-3.10.2.tar.gz
cd cmake-3.10.2
./configure; make
sudo make install
You can check the link to the latest version here https://cmake.org/files/
Finally, we can install our own Shiny Server:
cd
git clone https://github.com/rstudio/shiny-server.git
cd shiny-server
DIR=`pwd`
PATH=$DIR/bin:$PATH
mkdir tmp
cd tmp
PYTHON=`which python`
sudo cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON="$PYTHON" ../
sudo make
mkdir ../build
(cd .. && ./bin/npm --python="$PYTHON" rebuild)
(cd .. && ./bin/node ./ext/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js --python="$PYTHON" rebuild)
sudo make install
Last steps, post-Install with default configuration:
cd
sudo ln -s /usr/local/shiny-server/bin/shiny-server /usr/bin/shiny-server
sudo useradd -r -m shiny
sudo mkdir -p /var/log/shiny-server
sudo mkdir -p /srv/shiny-server
sudo mkdir -p /var/lib/shiny-server
sudo chown shiny /var/log/shiny-server
sudo mkdir -p /etc/shiny-server
Create Shiny Server configuration file:
cd
sudo cp shiny-server/config/default.config /etc/shiny-server/
sudo cp default.config shiny-server.conf
And now, we can add and run our first Shiny Application:
cd
sudo mkdir /srv/shiny-server/example
sudo cp shiny-server/samples/sample-apps/hello/ui.R /srv/shiny-server/example/
sudo cp shiny-server/samples/sample-apps/hello/server.R /srv/shiny-server/example/
Copy sample app from cloned repo to the /srv/shiny-server/ directory.
Change file permissions and run Shiny Server:
cd
sudo chmod 777 -R /srv
sudo shiny-server
Now open your web browser and go to: {{your-raspberry-IP-adress}}:3838, e.g http://192.161.1.2:3838. Here is a list of your all aplications from /srv/shiny-server directory. Click on our example to run it. Enjoy! :)