Is it time to spin up a new instance of Shiny Server? This tutorial is baseed on a fresh install of Ubuntu Server 14.04, but I’m sure it could be tweaked to work on RHEL or CentOS as well. There’s no real secret sauce to the install but there are several “gotcha’s” that most people overlook. The walk-through below can get you up and running in just a few minutes.
1. Make sure you have the latest version of R.
If you don’t have the R environment on your box already. See here for the install.
sudo apt-get update && sudo apt-get upgrade
2. Install shiny package for R via command line.
sudo su - -c "R -e "install.packages('shiny', repos='http://cran.rstudio.com/')""
3. Make sure you have these dependencies.
sudo apt-get install -y libcurl4-openssl-dev sudo apt-get install -y libxml2-dev
…and don’t forget Java!
sudo apt-get install -y openjdk-7-jdk export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server sudo R CMD javareconf
Change R package directory from user-based to system-wide. Find the below lines in your Renviron file and use your favorite text editor to swap the comment hashes to the configuration below.
sudo nano /usr/lib/R/etc/Renviron
Your Renviron file should look like this when you’re done.
5. Check lib paths in R to make sure your package library changed correctly.
“/usr/local/lib/R/site-library” should be the first of the library paths.
5. Make your new package lib readable for Shiny Server.
sudo chmod 777 /usr/lib/R/site-library
6. Install a few R packages.
It will ask if you want to create a personal directory, select “no.” You want them in the universal directory you just created.
R install.packages(c('RJDBC', 'RJSONIO', 'rmarkdown', 'dplyr'))
7. Install Shiny Server.
sudo apt-get install -y gdebi-core sudo wget http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-22.214.171.1243-amd64.deb sudo gdebi shiny-server-126.96.36.1993-amd64.deb
8. Set permissions for Shiny Server directory so outside users can see your apps.
sudo chmod -R 777 /srv