How To Set Up Shiny Server on Ubuntu 14.04

Published on June 28, 2015
How To Set Up Shiny Server on Ubuntu 14.04


Shiny is an R package that allows users to convert R code into an interactive webpage. Shiny server is a server provided by RStudio that can be used to host and manage Shiny applications on the web. Other than hosting Shiny applications, Shiny Server can also host interactive R markdown documents. Shiny Server has both a free open source version and a paid professional version that includes more features.

In this guide, we will learn how to set up the open source Shiny Server on a DigitalOcean Droplet running Ubuntu 14.04. If your Droplet is running a different version of Ubuntu or a different Linux distribution, most of the instructions will still apply, but you may need to modify some of the commands to match your specific distribution. You can also use this guide to set up Shiny Server Professional. Following this guide to completion should take about 10-15 minutes.


For this tutorial, you will need:

All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by sudo. Initial Server Setup with Ubuntu 14.04 explains how to add users and give them sudo access.

Note: for the remainder of this guide, whenever you see your_server_ip, you need to replace it with your Droplet’s IP.

Step 1 — Installing Shiny

Before installing Shiny Server, we need to install the shiny R package. We will install shiny in a way that will make it available to all users on the server.

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

Note: if you’re familiar with R, you might be tempted to install packages directly from R instead of from the command line. The approach used here is the safest way to ensure the installed package gets installed for all users and not just for the user currently running R.

Step 2 — Installing Shiny Server

We’re going to install Shiny Server with the GDebi tool, so first we need to install it.

  1. sudo apt-get install gdebi-core

Now we’re ready to download Shiny Server. Assuming your droplet is running 64-bit Ubuntu, use the following command to download Shiny Server.

  1. wget -O shiny-server.deb http://download3.rstudio.org/ubuntu-12.04/x86_64/shiny-server-

This will download Shiny Server version, which is the most up-to-date Shiny Server at the time of this writing. If you want to download the newest version, you can consult the official Shiny Server download page to find the latest version and change the URL accordingly. If you’re running a 32-bit operating system or a non Ubuntu distribution, you may need to consult the Shiny Server download page for specific instructions for your operating system.

Now use GDebi to install the file that was downloaded.

  1. sudo gdebi shiny-server.deb

Shiny Server should now be installed and running on port 3838. You should be able to see a default welcome screen at http://your_server_ip:3838/.

Shiny Server default welcome page

You can make sure your Shiny Server is working properly by going to http://your_server_ip:3838/sample-apps/hello/.

Step 3 — Hosting Interactive R Markdown Documents

Shiny Server is useful not only for hosting Shiny applications, but also for hosting interactive R markdown documents. You can learn more about interactive R markdown documents on RStudio’s official Rmarkdown site.

At this point you should have a working Shiny Server that can host Shiny applications, but it cannot yet host interactive R markdown documents because the rmarkdown R package isn’t installed. Shiny Server comes with a sample interactive document that is available at http://your_server_ip:3838/sample-apps/rmd/. If you go to that URL right now, you will see an error.

Let’s install the rmarkdown package to fix that.

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

Now Shiny Server is set up to run interactive R markdown documents as well as Shiny applications. To verify that interactive documents work, go to http://your_server_ip:3838/sample-apps/rmd/ and ensure there is no error.

Step 4 — Installing Shiny Server Professional (Optional)

Only perform this step if you have purchased a Shiny Server Professional license and would like to use the license on this server.

After purchasing the license, RStudio will give you a URL to use to download the Shiny Server Pro file. Download the Shiny Server Pro file.

  1. wget -O shiny-server-pro.deb Shiny_Server_Pro_URL

Install Shiny Server Pro.

  1. sudo gdebi shiny-server-pro.deb

You will also be given a Product Key that will be required to activate Shiny Server Pro.

  1. sudo /opt/shiny-server/bin/license-manager activate Product_Key

Restart Shiny Server Pro so that the activated version will get started.

  1. sudo reload shiny-server

Next Steps

You now have a functioning Shiny Server that can host Shiny applications or interactive documents. The configuration file for Shiny Server is at /etc/shiny-server/shiny-server.conf. By default it is configured to serve applications in the /srv/shiny-server/ directory. This means that any Shiny application that is placed at /srv/shiny-server/app_name will be available to the public at http://your_server_ip:3838/app_name/.

It’s a good idea to have a look at the Shiny Server Administrator’s Guide to learn how to customize the server to your exact needs and how to manage it.

To learn more about writing Shiny applications, read the tutorials on rstudio.com.

To learn more about writing interactive R markdown documents, check out the R Markdown page on rstudio.com.


In this guide, we went through the steps required to set up Shiny Server on an Ubuntu 14.04 Droplet. By setting up Shiny Server, we are able to host Shiny applications and interactive R documents on the web in a way that is accessible to the public.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Default avatar
Tammy Fox


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Hi, Wondering is there another version for setting up Python and Dash on the cloud?

Sincerely, Thiam Huat

Your article is very interesting, I also try But encountered a bottleneck

[Environmental Erection / Problem Briefing] I set up on the entity machine ubuntu shiny server This is the path of shiny examples on ubuntu server $cd/opt/shiny-server/samples/sample-apps

(Problem !!!) But there was an error when trying the leaflet map suite:

Ps. But leaflet can be used in the js @ _ @

[Code] The code is from

ui.R ------------------------------------------

library(leaflet) library(shiny)

fluidPage( h1(“hpc map test”), leafletOutput(‘map’,width = “100%”,height = 800) )

server.R ---------------------------------- library(shiny) library(leaflet)

function(input,output){ output$map <- renderLeaflet({ leaflet() %>% addTiles() %>% setView(lng=120.601,lat=24.179,zoom=16) }) }

[Error Message] Web page message

Of the URL will be the following error message: Error: An error has occurred. Check your logs or contact the application author for more information.

  1. Press F12 to select console, an error message appears Could not load resource: server response status is 500 (internal server error)

  2. $cd/var/log/shiny-server There is no relevant error message

[Environment Version] Ubuntu 14.04.05 Shiny-server 1.5.1 R 3.3.2 Leaflets 1.0.1

I have no ideal QQ

I had a couple of frustrating issues during installation, the main one being not enough RAM! I’d previously created a swapfile for another reason (composer) a while ago, but for some reason this no longer existed (maybe I changed permissions or something). This article is super useful & easy: https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04.

I followed these instructions and everything seemed to work fine (the demo apps run, and I can log into Rstudio). But when I try to use Rstudio I can’t run shiny apps (or access help files). Every time Rstudio tries to open a new browser I get this message:

This site can’t be reached refused to connect. ERR_CONNECTION_REFUSED

The Rstudio console reports the following:

Error in as.character(tools:::httpdPort) : cannot coerce type ‘closure’ to vector of type ‘character’

Any ideas how to fix this??

This comment has been deleted

    Do you know why it doesn’t work when installing from source ? Can you reproduce it ?

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Join the Tech Talk
    Success! Thank you! Please check your email for further details.

    Please complete your information!

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel