Shiny server working on Windows based virtual machine

Working in the NHS as I do, which runs all of its IT on Windows, I’d always despaired of being able to get Shiny Server working. However, I went to see the IT department and they have very kindly given me access to a virtual machine with Ubuntu 12.04.04 LTS running on it. It’s completely firewalled from the internet and is only visible from within the network, which is quite useful because it means I can put up things on it which are not for public consumption.

So the question was, will it run Shiny server without any problems? I’m very happy to say yes. This is a great development since it means I can run Shiny Server behind our corporate firewall and share things with people in the organisation with it very easily. Here’s a quick guide to what I did to get it working. I can’t say for sure if it will all work for you, depends on ports and probably lots of random other things, but it can’t hurt to try.

First job, of course, is to install R. Follow the link for a great summary of installing at the command line.

DON’T, as the Shiny Server documentation suggests, just run apt-get install r-base because the version in the repository is only 2.14 for which a lot of important packages are not available

I found on an NHS network that I had port problems, so instead of running:

gpg --keyserver --recv-key E084DAB9

Run this instead.

gpg --keyserver hkp:// --recv-key E084DAB9

Worked for me anyway.

Now run:

sudo apt-get update

For me, this generated an error (again because of port problems):

GPG error: […] The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 51716619E084DAB9

So I ran this:

sudo apt-key adv --keyserver hkp:// --recv-keys 51716619E084DAB9

Now install:

sudo apt-get install r-base-dev

Now let’s install Shiny Server, follow the instructions here.

Boom. Navigate to (put your actual IP in here, obviously) and you should find the example application, give it a test, and you’re off.

Once you start running applications you will no doubt need to install R packages, I find it easier to launch R, run .libPaths() and make myself the owner of one of these directories:

sudo chown chrisbeeley /usr/lib/R/site-library/

That way you can just run install.packages(“ggplot2”) from within R rather than faffing around with R CMD INSTALL and all the packages will install into the site library.


7 thoughts on “Shiny server working on Windows based virtual machine”

  1. Hi!
    Thank you for the post.
    I’m in the exact same situation.
    I have the shiny server running in a virtual Linux server in my company.
    However, my problem is that the shiny applications use some R code that needs to access Windows SQL servers with windows authentication.

    Do you have any idea how can I solve this?

    Thank you!

    1. Gosh, I really don’t know, I’m afraid. I’ve connected to MySQL instances on Linux servers, never tried Windows.

      The only thing I can think of is write an R script that pulls data from SQL and saves as .Rdata, get your IT people to run that for you nightly on Windows and then put the file somewhere your virtual server can get to. I do the same thing with mine, I don’t run the MySQL over Shiny because I don’t want the server to get overloaded with requests, easier to just use a .Rdata file.

      But you probably thought of that. Sorry I can’t be of more help.

  2. Hi,

    I just developed a shiny app, but I have some difficulties to host it online. I saw that you used a virtual machine working on windows. So, I wonder if the result is that you can get a web link shareable easily on internet, like for I mean without limitations of time or use. Because I look for an alternative to, which is easy to use, but limited with the free account.
    Thank you for your understanding,
    Best Regards,


    1. Sorry for the delay, the notifications for comments on my blog is broken. Yes, absolutely you can share a link to the application as long as you can host it. By default it will be visible at the root of your website on port 3838, e.g. on my website it would be

      It doesn’t run on that port, because some firewalls don’t like it, I changed it to 8080. There’s an example here

      For more details see here

  3. Hello, have you tried to access data on the host windows computer via the shiny server – hosted app? I’m facing issues with accessing data in folders shared by the host computer with the VM. I believe it is a permissions issue but I am not sure how to mount the folder where there is “other” user read write permissions.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.