So, you’ve decided you want to make your shiny application available to the world? Good news! You can do that easily with a VPS or a dedicated server, since shared hosting will not allow you to have the necessary shell access to complete the installation. One day, RStudio may open up the Shiny cloud. Until then, I am using Dreamhost’s VPS to house my shiny creations. These are the steps that I took.
To install R the latest version of R (v3.0.3), we must follow the steps listed here:
First, log in to your server using PuTTY or an alternative client.
Special Install Instructions for Dreamhost VPS!
For those using Dreamhost VPS, note that the OS is Debian Squeeze (6.0.x) and NOT Debian Wheezy (7.~)! As a result, a modification to the
must be made:
# Make /etc/apt/sources.list writable sudo touch /etc/apt/sources.list sudo chmod a+w /etc/apt/sources.list # Opens VIM to edit the file vim /etc/apt/sources.list # Add to the last line of /etc/apt/sources.list deb http://cran.wustl.edu/bin/linux/debian squeeze-cran3/ # If you are far away from wustl, view the list of cran mirros to choose from here: http://cran.r-project.org/mirrors.html # To exit out of vim use :wq
Back in terminal execute the following:
# Add the key signed by Debian backports archives on CRAN apt-key adv --keyserver keys.gnupg.net --recv-key 381BA480
End Dreamhost Specific Install Instructions
General Install Guidelines:
# Download newest information on the package lists sudo apt-get update # Install the latest and greatest r/r-dev. sudo apt-get install r-base r-base-dev # Make sure we are fully up-to date by fetching new versions of existing packages sudo apt-get upgrade
# Install Shiny package in R terminal sudo su - \ -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\"" # Error came up? See below for specifics! # Install gdebi sudo apt-get install gdebi-core # Download the prebuilt server image wget http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-18.104.22.168-amd64.deb # Install image sudo gdebi shiny-server-22.214.171.124-amd64.deb
Assuming there are no errors, you are done! But, alas, life isn’t so simple. So, here are a few errors I ran into.
Errors. Errors Where art thou?
Do NOT open R without
sudo! Using regular R will give:
# In terminal, open r without sudo! R
Installing package into '/usr/local/lib/R/site-library' (as 'lib' is unspecified) Warning in install.packages("shiny", repos = "http://cran.rstudio.com") : 'lib = "/usr/local/lib/R/site-library"' is not writable Would you like to use a personal library instead? (y/n) y Would you like to create a personal library ~/R/x86_64-pc-linux-gnu-library/3.0 to install packages into? (y/n) n
This does NOT work well, since the packages are then installed to a specific
library. They need to be installed into:
is the site wide library. Therefore, make sure you do:
# In terminal, open _R_ WITH `sudo`! sudo R
The dreaded configure error courtesy of
RJSONIO. The error will be given as:
* installing *source* package 'RJSONIO' ... ** package 'RJSONIO' successfully unpacked and MD5 sums checked ERROR: 'configure' exists but is not executable -- see the 'R Installation and Administration Manual' * removing '/usr/local/lib/R/site-library/RJSONIO' ERROR: dependency 'RJSONIO' is not available for package 'shiny' * removing '/usr/local/lib/R/site-library/shiny' The downloaded source packages are in '/tmp/RtmpWWV73L/downloaded_packages' Warning messages: 1: In install.packages("shiny", repos = "http://cran.rstudio.com/") : installation of package 'RJSONIO' had non-zero exit status<br /> 2: In install.packages("shiny", repos = "http://cran.rstudio.com/") : installation of package 'shiny' had non-zero exit status
# Option 1 # create directory mkdir ~/tmp # Make read/write. chmod 777 ~/tmp export TMPDIR=~/tmp # Option 2 mkdir /home/YOUR-USERNAME-HERE/tmp chmod 777 /home/YOUR-USERNAME-HERE/tmp export TMPDIR=/home/YOUR-USERNAME-HERE/tmp
Within sudo R:
# First, check to see if TMPDIR was set: Sys.getenv("TMPDIR") # IF this responds with the above path, skip this # Set the TMPDIR variable to be the correct folder. Sys.setenv("TMPDIR"="/home/YOUR-USERNAME-HERE/tmp") # Install packages like normal: install.packages('shiny', repos='http://cran.rstudio.com')