Installing RStudio & Shiny Servers

2018-11-13 R Andrew B. Collier

I did a remote install of Ubuntu Server today. This was somewhat novel because it’s the first time that I have not had physical access to the machine I was installing on. The server install went very smoothly indeed.

The next tasks were to install RStudio Server and Shiny Server. The installation process for each of these is well documented on the RStudio web site:

These are my notes. Essentially the same, with some small variations.

RStudio Server

  1. Install a recent version of R.
  2. Download the distribution.

    wget https://download2.rstudio.org/rstudio-server-1.1.463-amd64.deb
  3. Install the server.

    sudo dpkg -i rstudio-server-1.1.463-amd64.deb
  4. Verify the installation.

    sudo rstudio-server verify-installation
  5. RStudio Server runs on port 8787, so you should be able to access it in a browser at http://<server-ip>:8787.

Find out more about managing the server.

Whether or not to Start at Boot

RStudio Server does not consume an awful lot of RAM. But on a small machine, every bit of memory can be precious. So perhaps you don’t want to have RStudio Server running all the time? No problem!

# Check whether RStudio Server is running.
systemctl is-active rstudio-server

# Disable RStudio Server at boot.
sudo systemctl disable rstudio-server

# Enable RStudio Server at boot.
sudo systemctl enable rstudio-server

You can then start and stop RStudio Server as and when required.

# Start RStudio Server.
sudo systemctl start rstudio-server

# Stop RStudio Server.
sudo systemctl stop rstudio-server

Shiny Server

  1. Become root and install the shiny package.

    sudo su
    R -e "install.packages('shiny', repos='https://cran.rstudio.com/')"
    exit
  2. Download the distribution.

    wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.9.923-amd64.deb
  3. Install the server.

    sudo dpkg -i shiny-server-1.5.9.923-amd64.deb
  4. Shiny Server runs on port 3838, so you should be able to access it in a browser at http://<server-ip>:3838.

Whether or not to Start at Boot

You can also disable Shiny Server being automatically started at boot.

# Disable Shiny Server at boot.
sudo systemctl disable shiny-server
Next: Scraping the Turkey Accordion.
Previous: Accessing Open Data from AWS.