Install Streamlit on Ubuntu 20.04

In this article, we’ll explain how to install Streamlit on Ubuntu 20.04.

Streamlit is the fastest way to build and share data apps. Streamlit turns data scripts into shareable web apps in minutes. All in Python. All for free. No front‑end experience required. It is an open-source app framework for Machine Learning and Data Science teams. Create beautiful data apps in hours, not weeks.

Prerequisites:

  • A Ubuntu 20.04 installed dedicated server or KVM VPS.
  • A root user access or normal user with administrative privileges.

Install Streamlit on Ubuntu

1. Keep the server updated

Update the server using following command:

# apt update -y && apt upgrade -y

2. Install python pip

Install python pip package manager using following command:

# apt install python3-pip -y

3. Install Streamlit

Install Streamlit using python pip package manager.

# pip install streamlit

4. Deploy Streamlit app

To deploy Streamlit app, first we need to create one python file using following command:

# vim app.py

Add following content in the app.py file:

import streamlit as st
st.text_input("Your name", key="name")

# You can access the value at any point with:
st.session_state.name

Save and exit.

Now, deploy the app on :80 port using following command:

# streamlit run main.py –server.port 80

Navigate to your browser and access Streamlit app using your server IP.

5. Use Screen

Streamlit will close the session as soon as you exit SSH session. To make it persistence, we need to use screen tool. Once you create session in screen, you can close the terminal and connect the server using new terminal. It will create persistence session.

# screen -S streamlit

Deploy Streamlit app:

# streamlit run main.py –server.port 80

Now close the terminal and connect with server in new terminal and run following command list the screen session.

# screen -list

We have successfully completed with the installation process and also we have deployed our first app.

In this article, we have seen how to install Streamlit on Ubuntu 20.04.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

2 days ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

2 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

3 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

4 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

4 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

5 days ago