---
title: "How To Install Shiny Server on Ubuntu"
description: "Learn the ins-and-outs of installing the Shiny Server and showcase your Python and R apps in this ATA Learning tutorial!"
canonical: "https://adamtheautomator.com/shiny-server/"
---

# How To Install Shiny Server on Ubuntu

> Learn the ins-and-outs of installing the Shiny Server and showcase your Python and R apps in this ATA Learning tutorial!

Source: https://adamtheautomator.com/shiny-server/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![How To Install Shiny Server on Ubuntu](https://adamtheautomator.com/wp-content/uploads/2023/10/shiny-server.jpg)

# How To Install Shiny Server on Ubuntu

[![](https://secure.gravatar.com/avatar/2788bb1a3f735603f81eca51d68daec56a9d97e805a10268fb2c20afcc76b81b?s=192&d=mm&r=g)Nicholas Xuan Nguyen](https://adamtheautomator.com/author/nicholas-xuan-nguyen/)10 October 20237 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Ubuntu Linux](/tag/ubuntu-linux/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [Installing R on Ubuntu for the Shiny Server Installation](#installing-r-on-ubuntu-for-the-shiny-server-installation)
*   [Installing the Shiny R Package for Creating Interactive Web Apps](#installing-the-shiny-r-package-for-creating-interactive-web-apps)
*   [Downloading and Installing the Shiny Server](#downloading-and-installing-the-shiny-server)
*   [Enabling Web Browser Access to the Shiny Server](#enabling-web-browser-access-to-the-shiny-server)
*   [Accessing the Shiny Server and Finalizing the Installation](#accessing-the-shiny-server-and-finalizing-the-installation)
*   [Conclusion](#conclusion)

Ever dreamt of seamlessly deploying your data-driven applications for the world to see? Well, if you are here, you are probably facing the challenge of getting Shiny Server running on your Ubuntu system — a real head-scratcher!

But fear not; by the end of this tutorial, you will have a fully functional Shiny Server ready to host your interactive data applications.

Effortlessly showcase your projects to colleagues, clients, or even a global audience with Shiny Server!

## Prerequisites

Before you dive in, ensure you have the following in place to ensure a smooth setup as you follow along with the hands-on demonstrations:

*   A system running Ubuntu 18 or later – This tutorial uses Ubuntu 20.04.

Related:[How to Install Ubuntu 20.04 \[Step-by-Step\]](https://adamtheautomator.com/install-ubuntu/)

*   A user with full sudo privileges.

Related:[How to Create User on Ubuntu Linux in Multiple Ways](https://adamtheautomator.com/create-user-on-ubuntu/)

## Installing R on Ubuntu for the Shiny Server Installation

With the prerequisites sorted, the next step is to get your Ubuntu system geared up for Shiny Server. You must install one of Shiny Server’s crucial components, the [R programming language](https://www.guru99.com/r-programming-introduction-basics.html). Shiny applications are written in R, so you need R to interpret and run your code.

To install R on your Ubuntu machine, carry out these steps:

1\. Open your terminal, and run the below `wget` command to perform the following:

*   Download the public key for the Comprehensive R Archive Network (CRAN) repository (_`marutter_pubkey.asc`_).
*   Add (`tee`) the downloaded public key to the list of trusted keys in the Advanced Packaging Tool (APT) system (_`cran_ubuntu_key.asc`_).

Following this process ensures that your system trusts the packages you download from the CRAN repository. Moreover, doing so is a smart move to help safeguard against any potentially harmful installations.

```bash
sudo wget -qO- <https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc> | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
```

Related:[PowerShell wget : Awesome Way to Download a File](https://adamtheautomator.com/powershell-download-file/)

![ Downloading and adding the public key for the CRAN repository](https://adamtheautomator.com/wp-content/uploads/2023/10/image-36-1024x627.png)

Downloading and adding the public key for the CRAN repository

2\. Next, execute the following [`gpg --show-keys`](https://confluence.atlassian.com/bitbucketserver/using-gpg-keys-913477014.html) command to check if the public key has been correctly added.

```bash
sudo gpg --show-keys /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc
```

![Verifying the newly added public key](https://adamtheautomator.com/wp-content/uploads/2023/10/image-35.png)

Verifying the newly added public key

3\. With the public key verified, run the [`add-apt-repository`](https://linuxize.com/post/how-to-add-apt-repository-in-ubuntu/) command below to add the CRAN repository for R to your list of apt sources.

```bash
sudo add-apt-repository "deb <https://cloud.r-project.org/bin/linux/ubuntu> $(lsb_release -cs)-cran40/"
```

![Adding the CRAN repository for R to your list of apt sources](https://adamtheautomator.com/wp-content/uploads/2023/10/image-34.png)

Adding the CRAN repository for R to your list of apt sources

4\. Now, run the below [`apt update`](https://linuxize.com/post/how-to-use-apt-command/#updating-package-index-apt-update) command to update apt sources and pick up the new CRAN sources.

```bash
sudo apt update -y
```

![Updating apt sources](https://adamtheautomator.com/wp-content/uploads/2023/10/image-33.png)

Updating apt sources

Related:[Learning Ubuntu Apt Get Through Examples](https://adamtheautomator.com/ubuntu-apt-get/)

5\. Once updated, invoke the below [`apt install`](https://linuxize.com/post/how-to-use-apt-command/#installing-packages-apt-install) command to download and install R.

```bash
sudo apt install r-base r-base-dev -y
```

![Downloading and installing R on Ubuntu](https://adamtheautomator.com/wp-content/uploads/2023/10/image-32.png)

Downloading and installing R on Ubuntu

6\. Execute the following command to switch to the root user (`-i`) and start the `R` interpreter.

```bash
sudo -i R
```

If your prompt changes to the one below (**\>**), you have successfully installed R on your Ubuntu system.

![Opening an interactive R shell session](https://adamtheautomator.com/wp-content/uploads/2023/10/image-31.png)

Opening an interactive R shell session

7\. Lastly, run the below `quit()` command exit out of the R CLI.

```
quit()
```

![Quitting the R shell](https://adamtheautomator.com/wp-content/uploads/2023/10/image-30.png)

Quitting the R shell

## Installing the Shiny R Package for Creating Interactive Web Apps

Now that you have R installed on your system, you are almost ready to tap into the full potential of R for creating dynamic, web-based dashboards and applications. The show’s real star is the Shiny R package that you must install on your Ubuntu system.

Shiny R is open-source and is like magic for your R code, letting you effortlessly turn your analyses into web apps — no HTML, CSS, or JavaScript needed!

To install the Shiny R Package, follow these steps:

Run the following command to switch to the root user (`su -`), and execute (`-c`) an R command (`R -e`) that installs (`install.packages`) the `shiny` package from a specific repository.

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

> _💡 Instead of launching the R shell, this command lets you execute an R command directly. This approach is handy for automation (scripting and batch processing) and remote execution when you do not have a graphical interface to open an R session._

If everything goes well, you will see the following output.

![Installing the Shiny R Package](https://adamtheautomator.com/wp-content/uploads/2023/10/image-37.png)

Installing the Shiny R Package

Now, run the command below to switch back to the root user (`su -`) and execute an R command (`R -e`). This R command checks and displays the currently installed `packageVersion` of the `shiny` package.

```bash
sudo su - -c "R -e \"packageVersion('shiny')\""
```

![Checking the Shiny R package’s current installed version](https://adamtheautomator.com/wp-content/uploads/2023/10/image-38.png)

Checking the Shiny R package’s current installed version

## Downloading and Installing the Shiny Server

With the Shiny R package setup, you need a platform for your Shiny applications to dazzle and engage your audience. Shiny Server is an open-source application that allows you to host and manage interactive web applications written in R.

Shiny Server handles the networking aspects of hosting a web application, so you do not need to be an expert in web development to host and share your Shiny applications.

To download and install Shiny Server, perform the steps below:

1\. Run the below command to install the `gdebi-core` package. This package allows you to install packages from local deb files.

```bash
 sudo apt install gdebi-core -y
```

![Installing the gdebi-core package](https://adamtheautomator.com/wp-content/uploads/2023/10/image-42.png)

Installing the gdebi-core package

2\. Next, run the below `wget` command to download the latest version of the `shiny-server` deb package to your local machine. At this time of writing, the [latest version](https://posit.co/download/shiny-server/) is 1.5.20.

Related:[Comprehensive Guide to Install Deb Packages on Ubuntu](https://adamtheautomator.com/install-deb-packages-on-ubuntu/)

```bash
sudo wget https://download3.rstudio.org/ubuntu-18.04/x86_64/shiny-server-1.5.20.1002-amd64.deb
```

![Downloading the latest shiny-server deb package](https://adamtheautomator.com/wp-content/uploads/2023/10/image-41.png)

Downloading the latest shiny-server deb package

3\. Now, run the `echo` command below to verify the SHA-256 hash of the downloaded file. It’s a good practice to verify the integrity of the downloaded deb file.

```bash
echo "36667a9fbe59a103dcc147766cbf06027034887c3efb82a3c13bba32e255633b shiny-server-1.5.20.1002-amd64.deb" | sha256sum -c
```

You will see a similar output as the one below, indicating that the file integrity is as expected(OK).

![Checking the SHA-256 hash of the downloaded file](https://adamtheautomator.com/wp-content/uploads/2023/10/image-40.png)

Checking the SHA-256 hash of the downloaded file

Related:[Echo Command in Bash Shell : Discover the Many Uses](https://adamtheautomator.com/echo-command-in-bash/)

4\. Lastly, execute the following [`gdebi`](https://www.commandlinux.com/man-page/man1/gdebi.1.html) command to install the Shiny Server’s specific version (`shiny-server-1.5.20.1002-amd64.deb`)

```bash
sudo gdebi shiny-server-1.5.20.1002-amd64.deb
```

Type y and press Enter when prompted to continue.

If successful, you will see the Shiny Server’s status is **active (running)**, as shown below.

![Downloading and installing the Shiny Server](https://adamtheautomator.com/wp-content/uploads/2023/10/image-39.png)

Downloading and installing the Shiny Server

## Enabling Web Browser Access to the Shiny Server

Great job in installing the Shiny Server! But as it is, Shiny applications would remain confined. You must set up a virtual checkpoint — configuring the UFW firewall.

Related:[How To Set Up the UFW Firewall on Linux](https://adamtheautomator.com/ufw-firewall/)

Think of the firewall as having a bouncer at the entrance of an exclusive event, ensuring only the right guests get in. In this case, this process is about allowing users to access your Shiny Server via web browsers.

To enable web browser access to your Shiny Server, complete these steps:

1\. Execute the below [`ss`](https://phoenixnap.com/kb/ss-command) command to confirm that the Shiny Server is actively listening on port `3838`, the default port the Shiny Server service uses.

```bash
sudo ss -plut | grep 3838
```

Related:[Master Grep with Regex and Make Troubleshooting a Breeze](https://adamtheautomator.com/grep-with-regex/)

![Confirming that the Shiny Server is actively listening on port 3838](https://adamtheautomator.com/wp-content/uploads/2023/10/image-45.png)

Confirming that the Shiny Server is actively listening on port 3838

2\. Next, run the `ufw` command below to add a firewall rule to `allow` incoming network connections on port `3838`.

```bash
sudo ufw allow 3838
```

![Allowing incoming network connections on port 3838](https://adamtheautomator.com/wp-content/uploads/2023/10/image-44.png)

Allowing incoming network connections on port 3838

3\. Now, run the following command to check the current firewall `status` and rules.

```bash
sudo ufw status verbose
```

![Checking the current UFW firewall status and rules](https://adamtheautomator.com/wp-content/uploads/2023/10/image-43.png)

Checking the current UFW firewall status and rules

## Accessing the Shiny Server and Finalizing the Installation

Now that you have set up the virtual gateway through the UFW firewall, you must ensure users can step inside your Shiny universe.

You will test your Shiny Server’s accessibility over a web browser to witness firsthand how your Shiny applications come to life in a web-based interface.

To access your Shiny Server via a web browser, execute these steps:

1\. Open a modern web browser like Chrome or Firefox.

Related:[How to Install Google Chrome for Ubuntu](https://adamtheautomator.com/install-google-chrome-for-ubuntu/)

2\. Next, navigate to your server’s public IP address, followed by port 3838 (i.e., _http://159.x.x.x:3838_)

Related:[Get an IP Address on Linux : Discover the Many Ways](https://adamtheautomator.com/get-an-ip-address-on-linux/)

Assuming all goes smoothly, you will see Shiny Server’s welcome page like the one below.

![Accessing the Shiny Server](https://adamtheautomator.com/wp-content/uploads/2023/10/image-50.png)

Accessing the Shiny Server

3\. Scroll down, and confirm if you encounter an error, as shown below, that says **The application failed to start**.

When you see this error message, typically, there is a hiccup in getting your Shiny application running. Specifically, your Shiny Server is missing the rmarkdown package in this case. This package is crucial for creating those nifty dynamic reports in R.

![Verifying an error about the application failing to start](https://adamtheautomator.com/wp-content/uploads/2023/10/image-49.png)

Verifying an error about the application failing to start

4\. Now, run the below command to install the `rmarkdown` package from the CRAN repository (`http://cran.rstudio.com/`).

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

![Installing the rmarkdown package](https://adamtheautomator.com/wp-content/uploads/2023/10/image-48.png)

Installing the rmarkdown package

5\. Once the installation finishes, reload your web browser.

As you can see below, the error is gone, and you are now ready to start creating Shiny applications on your server.

![Verifying the error has been fixed](https://adamtheautomator.com/wp-content/uploads/2023/10/image-47.png)

Verifying the error has been fixed

6\. Scroll to the top, and click the hyperlink below (_**/sample-apps/hello/**_) to access a sample Shiny application named **hello.**

![Accessing a sample Shiny application](https://adamtheautomator.com/wp-content/uploads/2023/10/image-46.png)

Accessing a sample Shiny application

7\. Finally, adjust the slider on the left (the page is interactive) to see the histogram updating in real-time on the right. The interactive nature of Shiny allows users to manipulate inputs and see the results in real time.

![Testing a sample hello application](https://adamtheautomator.com/wp-content/uploads/2023/10/image.gif)

Testing a sample hello application

## Conclusion

You have successfully set up your own Shiny Server on Ubuntu, navigated through the intricacies of installing R, adding the Shiny R package, and smoothly running your Shiny Server.

With your web browser now primed for access, you have effortlessly entered the world of interactive data visualization. And to top it off, you have seen how a sample Shiny application works!

Now, why not explore more advanced topics, such as [setting up authentication](https://datastorm-open.github.io/shinymanager/), [connecting to a Postgres database](https://appsilon.com/r-shiny-postgres-database/), and [deploying applications online](https://support.posit.co/hc/en-us/articles/221319028-How-do-I-deploy-Shiny-applications-to-Shiny-Server-)? With Shiny Server at your disposal, the possibilities are boundless!

Related:[Install PostgreSQL on a Ubuntu for Security Configurations](https://adamtheautomator.com/install-postgresql-on-a-ubuntu/)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fshiny-server%2F&text=How%20To%20Install%20Shiny%20Server%20on%20Ubuntu)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fshiny-server%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fshiny-server%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2024/03/openldap-4.jpg)

### [How to Install and Configure an OpenLDAP Ubuntu Server](/openldap/)

Unlock the power of OpenLDAP on Ubuntu for centralized user authentication, seamless access control management, and enhanced directory services!

![](https://adamtheautomator.com/wp-content/uploads/2024/03/ubuntu-ntp.jpg)

### [How to Setup Ubuntu NTP Server](/ubuntu-ntp/)

Learn to configure an Ubuntu NTP server for precise time synchronization across your network. Ensure seamless operations with accurate timekeeping!

![](https://adamtheautomator.com/wp-content/uploads/2022/04/How-to-Install-Apache-on-Ubuntu.jpg)

### [Install Apache on Ubuntu and Master Website Traffic Management](/install-apache-on-ubuntu/)

Ready to optimize your website for high traffic? Install Apache on Ubuntu with this step-by-step guide and ensure smooth performance under heavy loads.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
