Shiny Server Installation

Steps

  • sudo apt-get install r-base
  • sudo su – \
    -c “R -e \”install.packages(‘shiny’, repos=’https://cran.rstudio.com/’)\””
  • sudo apt-get install gdebi-core
  • wget https://download3.rstudio.org/ubuntu-14.04/x86_64/shiny-server-1.5.16.958-amd64.deb
  • sudo gdebi shiny-server-1.5.16.958-amd64.deb

Edit Configuration File

  • You can change the shiny-server setting in /etc/shiny-server/shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

# Define a server that listens on port 3838
server {
  listen 3838;
  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}
  • site_dir: The folder which contains your shiny apps.
  • log_dir: The directory which will have your shiny server logs.

Check Status of Shiny Server

  • sudo systemctl status shiny-server

Enable Shiny Server

  • sudo systemctl enable shiny-server

Restart Shiny Server

  • sudo systemctl restart shiny-server
Sidebar