How to set up Shiny Server on Ubuntu 14.04

Introduction

Shiny is an R package that allows users to convert R code into interactive web pages. Shiny server is a server provided by RStudio, which can be used to host and manage Shiny applications on the Web. In addition to hosting Shiny applications, Shiny Server can also host [Interactive R Markdown Documents] (http://rmarkdown.rstudio.com/). Shiny Server has both a free open source version and a paid professional version with more features.

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

prerequisites

In this tutorial, you will need:

All commands in this tutorial should be run as a non-root user. If the command requires root access, it will have sudo in front.

**Note: **In the rest of this guide, when you see the IP of your server, you need to replace it with the IP of your CVM.

Step 1-Install Shiny

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

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

**Note: **If you are familiar with R, you may want to install packages directly from R instead of from the command line. The method used here is the safest way to ensure that the installed package is installed for all users, not just the user currently running R.

Step 2-Install Shiny Server

We will install Shiny Server using the GDebi tool, so first we need to install it.

sudo apt-get install gdebi-core

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

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

This will download Shiny Server version 1.3.0.403, which is the latest Shiny Server at the time of writing. If you want to download the latest version, you can check the official Shiny Server download page to find the latest version and change the URL accordingly. If you are running a 32-bit operating system or a non-Ubuntu distribution, you may need to refer to the Shiny Server download page, for specific instructions on the operating system.

Now use GDebi to install the downloaded file.

sudo gdebi shiny-server.deb

Shiny Server should now be installed and running on port 3838. You should be able to on http://your_server_ip:3838/

See the default welcome screen.

You can visit http://your_server_ip:3838/sample-apps/hello/ to ensure that your Shiny Server is working properly.

Step 3-Host Interactive Markdown Document

Shiny Server can be used not only to host Shiny applications, but also to host interactive R markdown documents. You can learn more about the interactive R markdown document on the official Rmarkdown website of RStudio.

At this point you should have a working Shiny Server that can host Shiny applications, but since the rmarkdownR package is not installed, it cannot yet host interactive R markdown documents. Shiny Server comes with a sample interactive document, which can be obtained from the following http://your_server_ip:3838/sample-apps/rmd/ location. If you go to that URL now, you will see an error.

Let's install the rmarkdown package to fix it.

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

Shiny Server is now set to run interactive R markdown documents and Shiny applications. To verify that the interactive document is valid, go to http://your_server_ip:3838/sample-apps/rmd/ and make sure there are no errors.

Step 4-Install Shiny Server Professional (optional)

If you have purchased a Shiny Server Professional license and want to use the license on this server, only perform this step.

After purchasing the license, RStudio will provide you with the URL to download the Shiny Server Pro file. Download the Shiny Server Pro file.

wget -O shiny-server-pro.deb Shiny_Server_Pro_URL

Install Shiny Server Pro.

sudo gdebi shiny-server-pro.deb

You will also get the product key required to activate Shiny Server Pro.

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

Restart Shiny Server Pro to start the activated version.

sudo reload shiny-server

Next step

You now have a powerful Shiny Server that can host Shiny applications or interactive documents. The configuration file of Shiny Server is located in /etc/shiny-server/shiny-server.conf. By default, it is configured to serve applications in the /srv/shiny-server/ directory. This means that all Shiny applications placed will be available to the public, and the public can visit /srv/shiny-server/app_name, http://your_server_ip:3838/app_name/ to get them.

It is best to check Shiny Server Administrator's Guide to learn how to customize the server according to your exact needs and how to manage the server.

To learn more about writing Shiny applications, please read Tutorial on rstudio.com.

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

in conclusion

In this guide, we have completed the steps required to set up Shiny Server on Ubuntu 14.04 Tencent CVM. By setting up Shiny Server, we can host Shiny applications and interactive R documents on the Web in a publicly accessible way.

For more Ubuntu tutorials, please go to [Tencent Cloud + Community] (https://cloud.tencent.com/developer?from=10680) to learn more.


Reference: "How To Set Up Shiny Server on Ubuntu 14.04"

Recommended Posts

How to set up Shiny Server on Ubuntu 14.04
How to set up a DNS server on Ubuntu 18.04
How to set up Gogs on Ubuntu 14.04
How to set up R on Ubuntu 14.04
How to set static IP on Ubuntu 18.04 Server
How to set static IP on Ubuntu 18.04 Server
How to set up time synchronization on Ubuntu 18.04
How to set up Java Home on Ubuntu and Raspbian
How to install Bacula Server on Ubuntu 14.04
How to set up a Masterless Puppet environment on Ubuntu 14.04
How to set up a firewall with UFW on Ubuntu 14.04
How to use Samba server on Ubuntu 16.04
How to set up vsftpd for anonymous downloads on Ubuntu 16.04
How to set PostgreSQL startup on Ubuntu 16.04
How to set up a production Elasticsearch cluster on Ubuntu 14.04
How to set up an Apache virtual host on Ubuntu 16.04
How to set up an Apache virtual host on Ubuntu 20.04
How to set up password authentication with Nginx on Ubuntu 14.04
How to set up vsftpd for user directories on Ubuntu 16.04
How to install Zabbix on Ubuntu 16.04 Server
How to set up the Nginx server configuration block on CentOS 8
How to set up SSH keys on CentOS 8
Explain how to set static IP on ubuntu14.04
How to quickly deploy docker on ubuntu server
How to run the parsing server on Ubuntu 14.04
How to set up Ghost one-click app for Ubuntu 16.04
How to set a fixed IP based on Ubuntu 16.04
How to open https on nginx server under Ubuntu
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
How to install Protobuf 3 on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
How to install Vagrant on Ubuntu 20.04
How to install Bacula-Web on Ubuntu 14.04
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Anaconda3 on Ubuntu 18.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
How to install MemSQL on Ubuntu 14.04
How to install Go on Ubuntu 20.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install PrestaShop on Ubuntu 16.04
How to upgrade to PHP 7 on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04
How to install KVM on Ubuntu 20.04
How to install opencv3.0.0 on ubuntu14.04
How to install Anaconda on Ubuntu 20.04
How to install Prometheus on Ubuntu 16.04
How to install Jenkins on Ubuntu 18.04