Site icon R-bloggers

Set Up Shiny-server on www.digitalocean.com

[This article was first published on Category: R | Huidong Tian's Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

RStudio supplies several servers for hosting user’s apps, e.g. http://www.shinyapps.io/, http://spark.rstudio.com, http://glimmer.rstudio.com. Thanks a lot to RStudio who has contributed many excellent R libraries! I want to set my shiny-server on a virtual private server (VPS), because I have some other tasks and I feel a VPS is more stable than the PC under my desk. < !-- more -->

Setting up a Shiny-server on Digital Ocean is easy, follow this blog you can get your shiny-server work in 10 minutes.

Login Putty use the username and password in your email. After log in, please change your password first using command passwd.

For security reason, add R’s secure APT key to system:

“` ruby sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9

“`

Add this repository

deb http://cran.uib.no/bin/linux/ubuntu precise/

to the end of sources.list to ensure the R that will be installed consistent with your system version:

ruby sudo nano /etc/apt/sources.list

Update and install R:

ruby sudo apt-get update sudo apt-get install r-base r-base-dev

Install shiny package:

ruby sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""

“` ruby sudo apt-get install gdebi-core wget http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-1.1.0.10000-amd64.deb sudo gdebi shiny-server-1.1.0.10000-amd64.deb

“`

If anything is OK, you can now access your shiny-server by typing your server’s IP address: 3838.

ruby sudo apt-get install gdebi-core sudo apt-get install libapparmor1 # Required only for Ubuntu, not Debian wget http://download2.rstudio.org/rstudio-server-0.98.507-amd64.deb sudo gdebi rstudio-server-0.98.507-amd64.deb

Due to RStudio Server will not permit logins by system users, so we need add a non-system user to our droplet, for example, I want to add a user named withr:

ruby adduser withr

Set the privilege of the user as equal to root will avoid many troubles!

ruby visudo

Add line withr ALL=(ALL:ALL) ALL after root ALL=(ALL:ALL) ALL , like the following:

ruby # User privilege specification root ALL=(ALL:ALL) ALL withr ALL=(ALL:ALL) ALL Save the edition.

Now, we can access the RStudio server through IP:8787 using withr and its password.

To leave a comment for the author, please follow the link and comment on their blog: Category: R | Huidong Tian's Blog.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.