How to Install Jellyfin Media Server on Ubuntu 22.04 or 20.04

Jellyfin Media Server is a beacon for those seeking an open-source and robust solution to manage and stream their media collections. For those aiming to install Jellyfin Media Server on Ubuntu 22.04 Jammy Jellyfish or its older stable release of Ubuntu 20.04 Focal Fossa, this introduction sheds light on its core features and the advantages it brings to the table.

Key Features of Jellyfin:

  • Open-Source and Cost-Free: Jellyfin offers a transparent and cost-free solution, setting it apart from other media servers that might have hidden fees.
  • Privacy-Centric: With Jellyfin, user privacy remains paramount. The platform refrains from tracking or collecting user data, ensuring a secure media streaming experience.
  • Broad Device Compatibility: Jellyfin’s adaptability ensures smooth streaming across various devices, from Windows, macOS, and Linux to Android, iOS, and leading smart TVs.
  • Intuitive User Experience: Jellyfin simplifies media library management and navigation by boasting a user-friendly interface. Users can also personalize the interface to resonate with their aesthetic preferences.
  • Comprehensive Media Support: Jellyfin’s ability to support various media formats eliminates the need for constant conversions or transcoding.
  • Expandable with Plugins: Users can augment their Jellyfin experience with various plugins and add-ons, ranging from metadata fetchers to subtitle providers.

With Jellyfin, you get a top-tier media server and become part of a community that values transparency, customization, and user privacy. This guide will navigate you through the steps to install Jellyfin on Ubuntu, ensuring you’re well-equipped to elevate your home entertainment system. We’ll also delve into configuring media drives for optimal access and securing your setup with trusted SSL certificates.

If you’re curious about the Jellyfin Media Server, there’s a live demo available. This is especially useful for first-time users considering a switch from Kodi or Plex.

Import Jellyfin APT Repository on Ubuntu 22.04 or 20.04

Step 1: Update Ubuntu Before Jellyfin Installation

To keep your Ubuntu operating system smooth and secure and to prevent issues when installing the Jellyfin Media Server, update your packages. Use the command line interface and enter the following command to update Ubuntu:

sudo apt update && sudo apt upgrade

This command will update the package list and upgrade all installed packages to the latest versions.

Step 2: Install Initial Packages For Jellyfin on Ubuntu

Before you install the Jellyfin Media server, ensure you have installed all the necessary packages on your Ubuntu system. These packages ensure a successful installation and smooth server operation.

To install the necessary packages, you can use the command line interface and execute the following command:

sudo apt install apt-transport-https ca-certificates curl -y

Step 3: Import Jellyfin Media Server APT Repository on Ubuntu

The default Ubuntu repository doesn’t include Jellyfin. You must import the Jellyfin GPG Key and repository to install the software. This confirms the package’s authenticity and verifies no one has tampered with it.

Import Jellyfin GPG Key on Ubuntu:

To import the GPG key, use this command:

curl -fsSL | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/jellyfin.gpg > /dev/null

This command will download the GPG key from the Jellyfin website and add it to your system’s keyring. This key is essential to verify the package’s authenticity during installation. Without this key, the installation will fail.

Import Jellyfin Repository on Ubuntu:

Choose between the stable and unstable Jellyfin repositories to import. We recommend the stable repository for most users because we’ve tested it extensively for stability. On the other hand, the unstable repository offers the latest development release, which might introduce bugs or instability to your Jellyfin Media server. Use the following command to select your desired repository:

To import Jellyfin Media Server stable (recommended):

echo "deb [arch=$( dpkg --print-architecture )]$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main" | sudo tee /etc/apt/sources.list.d/jellyfin.list

Alternatively, import Jellyfin Media Server unstable (development):

echo "deb [arch=$( dpkg --print-architecture )]$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release ) $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release ) main unstable" | sudo tee /etc/apt/sources.list.d/jellyfin.list

This command will add the Jellyfin repository to your Ubuntu system. It is necessary to import the repository to access the Jellyfin package and its dependencies.

Finally, update your system’s repository listing to recognize the new additions with the following command:

sudo apt update

This command will update your repository listing, ensuring Ubuntu recognizes the new repository and its contents.

Install Jellyfin on Ubuntu 22.04 or 20.04 via APT Command

After importing the Jellyfin repository and GPG key, you can install the media server on your Ubuntu system. The installation process is straightforward, and you can use the following command to install Jellyfin:

sudo apt install jellyfin

After completing the installation, Jellyfin automatically starts. To confirm, use the following command to check Jellyfin’s status:

systemctl status jellyfin
Screenshot showing systemd status OK for Jellyfin service on Ubuntu.Pin
Jellyfin service running smoothly on Ubuntu.

If the Jellyfin service has not started for any reason, you can use the following commands:

To start the service, use the following command:

sudo systemctl start jellyfin

Next, enable the service to start automatically during system boot, by using the following command:

sudo systemctl enable jellyfin

The commands start the Jellyfin service, enabling it to launch automatically during system boot.

Jellyfin Media Server Initial Setup on Ubuntu 22.04 or 20.04

To access the Jellyfin Web UI, you must open your internet browser and enter the IP address of your server, followed by the default port 8096. If you’re accessing the Jellyfin server on the same machine installed, use as the IP address.

For example, you can enter the following address in your browser’s address bar to access the Jellyfin Web UI:

Example below:

When you enter the given address, the welcome screen for the initial server setup appears. This screen outlines the essential steps to configure Jellyfin for the first time.

Example of the Jellyfin Welcome screen:

When you set up your Jellyfin server for the first time, the system prompts you to choose your preferred display language. After making your selection, click the “Next ->” button to continue.

Screenshot of Jellyfin's welcome screen during initial setup on Ubuntu.Pin
Beginning the Jellyfin setup journey on Ubuntu.

Next, the system asks you to create a username and password for your Jellyfin account. This account gives you administrative access to the Jellyfin server, enabling you to manage media libraries, user accounts, and server settings.

Choose a strong, unique password with a mix of uppercase and lowercase letters, numbers, and symbols to secure your Jellyfin server. After setting your username and password, click the “Next ->” button to move to the next phase of the server setup.

Example of creating username and password:

After creating your username and password, click the “Next ->” button. You can add more users after completing the initial setup.

Screenshot of user profile creation in Jellyfin on Ubuntu.Pin
Crafting a personalized Jellyfin experience on Ubuntu.

Next, set up your media libraries. Add your media content to Jellyfin by configuring these libraries. Jellyfin uses them to organize and display your media. Create separate libraries for movies, TV shows, and music.

Example of media libraries:

To add media content to Jellyfin, click the “+” or “Add Media Library” button on the Jellyfin dashboard. This click brings you to the Media Library setup screen where you can select your media folder.

Once you’ve added your media libraries, click the “Next ->” button. You’ll land on the Metadata Language screen. Here, pick the language you want for your media content’s metadata, enriching your collection with details like cast, plot summaries, and reviews.

Screenshot of adding media to Jellyfin libraries on Ubuntu.Pin
Enhancing the Jellyfin experience with diverse media.

The setup mirrors that of Plex, making it straightforward for those familiar with Plex. After clicking the “Add Media Library” button, select the type of media you want to add: movies, TV shows, or music.

After setting up your media libraries and choosing your metadata language, move to the next step: configuring remote access for your Jellyfin media server. Remote access lets you view media content from different locations or devices outside your local network.

Example of configuring remote access:

To enable remote access, allow remote connections to your Jellyfin media server and turn on automatic port mapping. Allowing remote connections lets you access your media from any location with internet connectivity. Meanwhile, automatic port mapping opens the required ports for incoming traffic to your Jellyfin server.

Screenshot of Jellyfin's remote access configuration UI on Ubuntu.Pin
Making Jellyfin accessible from anywhere.

Once you’ve selected it, you can proceed to the next step. The next screen confirms that you have finished the installation and that your Jellyfin media server is ready.

Example of initial setup complete:

Screenshot of Jellyfin's UI post first-time setup on Ubuntu.Pin
Celebrating the successful setup of Jellyfin on Ubuntu.

After confirming that you have finished the installation process, click the “Finish” button to complete the setup. This action will take you to the login screen, where you can sign in with the user account and password you created during the initial setup.

Example of Jellyfin sign-in screen on Ubuntu:

Enter your username and password to sign in to your Jellyfin media server, then click the “Sign in” button.

Screenshot of the Jellyfin sign-in page on Ubuntu.Pin
Securely accessing Jellyfin on Ubuntu.
Screenshot of the Jellyfin dashboard interface on Ubuntu.Pin
Navigating the central hub of Jellyfin on Ubuntu.

Troubleshoot: Reset the Initial Setup on Ubuntu 22.04 or 20.04

This section can be skipped unless you have issues or require to reset the installation process, then follow the steps below.

During the initial setup of your Jellyfin media server, you can reset the setup process if you make an error or mistake. To do this, modify the “IsStartupWizardCompleted” value in the system.xml file and restart the Jellyfin server.

First, open the system.xml file which you can do this by running the following command:

sudo nano /etc/jellyfin/system.xml

This command opens the system.xml file in the nano text editor, allowing you to change the file.

Modify the “IsStartupWizardCompleted” value:


And change it to:


This change resets the initial setup process, allowing you to start again from the beginning.

To restart the Jellyfin server, run the following command:

sudo systemctl restart jellyfin

Restart the setup process: Once you’ve restarted the Jellyfin server, you can revisit the HTTP:// and restart the setup process.

Configure Jellyfin Media Server Permissions For Media Drives on Ubuntu 22.04 or 20.04

After installing Jellyfin, the media server will require permission to read and execute your media directories. To do this, you can use the setfacl command, which allows you to control access at a very detailed level compared to the default chown and chgrp commands.

First, make sure you have the ACL package installed by running the following command:

sudo apt install acl

Next, to give Jellyfin access to your media directory and all its subdirectories, use the following command with the -R (recursive) flag:

sudo setfacl -R -m u:jellyfin:rx /media/mymediadrive

If you need to assign permissions to individual media directories or files, use the following command:

sudo setfacl -m u:jellyfin:rx /media/mymediadrive/example-name-of-file-or-directory

Additional Jellyfin Media Server Commands on Ubuntu 22.04 or 20.04

Configure Ubuntu Server SSH For Jellyfin Media Server

To access your Jellyfin Media Server remotely, set up an SSH tunnel. SSH provides a secure method for remote logins over insecure networks.

To establish an SSH tunnel on your local computer, replace {server-ip-address} with your server’s IP address. Use the following command to create the SSH tunnel for the Jellyfin Media Server:

ssh {server-ip-address} -L 8096:localhost:8096

For users without SSH, use the following command to install it:

sudo apt install openssh-server

After enabling the SSH service, access the Jellyfin Media Server using this link in your web browser:


Remember, when you use an SSH tunnel, it directs the HTTP request to http://localhost:8096/web on the remote server. After completing the initial setup, access your Jellyfin Media Server at https://{server-ip-address}:8096 using the remote server IP address.

Configure UFW Firewall For Jellyfin Media Server on Ubuntu

The Ubuntu Firewall (UFW) manages firewall rules in Ubuntu. By default, Ubuntu doesn’t enable UFW; users must activate it themselves. A firewall controls network traffic on your server.

Before moving on, configure UFW to allow only essential traffic. To activate UFW, use this command:

sudo ufw enable

To allow the Jellyfin Media Server port 8096, run the following command:

sudo ufw allow 8096

Allow incoming traffic on port 8096 to your server; Jellyfin Media Server needs this to function properly.

If you haven’t installed UFW, use the following command to install it:

sudo apt install ufw

Setup Apache or Nginx as a Reverse Proxy For Jellyfin Media Server on Ubuntu

You can set up a reverse proxy to access Jellyfin from a remote computer or network.

Setup Apache as a Reverse Proxy For Jellyfin Media Server on Ubuntu

To set up Apache as a reverse proxy, start by installing the Apache web server:

sudo apt install apache2

By default, Apache should be enabled. If not, use this command:

sudo systemctl start apache2

To start Apache on boot, use this command:

sudo systemctl enable apache2

Next, enable the necessary modules with the following command:

sudo a2enmod proxy proxy_http headers proxy_wstunnel

Create a new virtual host configuration file for Jellyfin using the following command:

sudo nano /etc/apache2/sites-available/jellyfin.conf

You need an active domain name to set up the subdomain. You can purchase a domain name for as little as $1 to $2 from NameCheap. If you prefer a .com, use Cloudflare.

After creating your subdomain, add the following to the virtualhost file you created:

<VirtualHost *:80>

    # Redirect HTTP to HTTPS
    Redirect permanent /

    ErrorLog /var/log/apache2/jellyfin-error.log
    CustomLog /var/log/apache2/jellyfin-access.log combined

<IfModule mod_ssl.c>
<VirtualHost *:443>

    DocumentRoot /var/www/html/jellyfin/public_html

    ProxyPreserveHost On

    ProxyPass "/socket" "ws://localhost:8096/socket"
    ProxyPassReverse "/socket" "ws://localhost:8096/socket"

    ProxyPass "/" "http://localhost:8096/"
    ProxyPassReverse "/" "http://localhost:8096/"

    SSLEngine on
    SSLCertificateFile /etc/letsencrypt/live/
    SSLCertificateKeyFile /etc/letsencrypt/live/
    Protocols h2 http/1.1

    SSLCipherSuite HIGH:RC4-SHA:AES128-SHA:!aNULL:!MD5
    SSLHonorCipherOrder on

    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

    ErrorLog /var/log/apache2/jellyfin-error.log
    CustomLog /var/log/apache2/jellyfin-access.log combined

Save the file (CTRL+O), then exit (CTRL+X).

Before enabling the virtual host, you can check whether there are any errors in the Apache configuration or virtual host file by performing a “dry run” using the following command:

sudo apache2ctl configtest

This command checks the Apache configuration syntax and returns “Syntax OK” if there are no syntax errors.

If there are no errors, you can enable the virtual host using the following command:

sudo a2ensite jellyfin.conf

The command establishes a symbolic link between the sites-available and sites-enabled directories, allowing Apache to serve the virtual host. After you activate the virtual host, restart Apache with this command:

sudo systemctl restart apache2

This command stops and starts the Apache service, reloads the configuration with the new changes, and applies the new virtual host settings.

Setup Nginx as a Reverse Proxy For Jellyfin Media Server on Ubuntu

Nginx, a popular, lightweight, high-performance web server, is an excellent reverse proxy for accessing your Jellyfin media server from remote computers or networks.

To install Nginx, use this command:

sudo apt install nginx

Nginx should be enabled by default. If not, use the following command to start it:

sudo systemctl start nginx

To ensure Nginx starts automatically on boot, use the following command:

sudo systemctl enable nginx

Example output if successful:

Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx

You can verify the status of Nginx with the following command:

sudo systemctl status nginx

After you’ve confirmed that Nginx is running correctly, create a new server block file at /etc/nginx/conf.d/jellyfin.conf.

sudo nano /etc/nginx/conf.d/jellyfin.conf

In this server block file, you’ll need to configure the following:

  • listen directive specifies the port and address Nginx should listen on. In this example, we’re using port 80.
  • server_name directive specifies the hostname or domain name Nginx should listen to. Replace with your domain name.
  • access_log and error_log directives: These define the locations of the access and error logs.
  • location directives: These specify how Nginx should handle incoming requests.

In the location directives, set up proxy_pass to forward requests from Nginx to Jellyfin. proxy_pass specifies the protocol and address of the Jellyfin server, which listens on port 8096. The location directive handles requests for the root URL (/), the /web/ directory, and the /socket directory.

Here is an example server block file:

server {
    listen 80;

    access_log /var/log/nginx/jellyfin.access;
    error_log /var/log/nginx/jellyfin.error;

    set $jellyfin jellyfin;
    resolver valid=30;

    # Security / XSS Mitigation Headers
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    location = / {
        return 302 https://$host/web/;

    location / {
        # Proxy main Jellyfin traffic
        proxy_pass http://$jellyfin:8096;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;

        # Disable buffering when the nginx proxy gets very resource heavy upon streaming
        proxy_buffering off;

    # location block for /web - This is purely for aesthetics so /web/#!/ works instead of having to go to /web/index.html/#!/
    location = /web/ {
        # Proxy main Jellyfin traffic
        proxy_pass http://$jellyfin:8096/web/index.html;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;

    location /socket {
        # Proxy Jellyfin Websockets traffic
        proxy_pass http://$jellyfin:8096/socket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-Protocol $scheme;
        proxy_set_header X-Forwarded-Host $http_host;

Save the file (CTRL+O), then exit (CTRL+X).

Once you configure Nginx as a reverse proxy for Jellyfin, ensure the configuration has no errors before moving on. Execute the following command for a dry run:

sudo nginx -t

This command will test the configuration file for syntax errors and other issues. If everything is working correctly, the output should show that the configuration file is ok and the test is successful, as follows:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Once you have verified that there are no errors in the configuration, you can reload Nginx to apply the changes:

sudo systemctl reload nginx

If you have set up your domain and DNS records to point to your server IP, you can now access your Jellyfin Media Server at With Nginx configured as the reverse proxy, remote users can access Jellyfin by visiting the subdomain, and Nginx will forward their requests to Jellyfin’s web interface.

Create Let’s Encrypt SSL Free Certificate For Jellyfin Media Server on Ubuntu

The section provides instructions for securing the Apache or Nginx with a Let’s Encrypt SSL Free Certificate. An SSL certificate is ideal for running the Apache or Nginx server on HTTPS. The purpose of using an SSL certificate is to ensure that the communication between the user’s browser and the server is secure.

To install the certbot package, the user must match the reverse proxy they have installed. For Apache, they need to install python3-certbot-apache, and for Nginx, they need to install python3-certbot-nginx.

sudo apt install python3-certbot-apache
sudo apt install python3-certbot-nginx

After installation, the user must create a certificate by running the certbot command. The command includes several options, such as –apache or –nginx, which the user can choose based on their reverse proxy. The command also has options like –agree-tos, –redirect, –hsts, and –staple-ocsp. These options include 301 redirects, a Strict-Transport-Security header, and OCSP Stapling, making it an ideal setup. The user must also replace the e-mail and domain name with their requirements.

Create Certbot Certificate for Apache:

sudo certbot --apache --agree-tos --redirect --hsts --staple-ocsp --email -d

Create Certbot Certificate for Nginx:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email -d

After creating the certificate, the user’s URL changes to from HTTP://

To renew the certificates automatically, the user can set a cron job that checks the certificate daily. Certbot offers a script that automatically renews the certificates. Before setting up the cron job, the user can test the script by running a dry run using the following command:

sudo certbot renew --dry-run

If the dry run is successful, you can set up the cron job. To set up the cron job, the user needs to use the following command:

sudo crontab -e

The user can specify the daily certificate check time. If the certificate requires renewal, the script updates it. For optimal cron job timing, users can consult This website’s calculator proves beneficial, especially for beginners. To set up the cron job, use the following command:

00 00 */1 * * /usr/sbin/certbot-auto renew

Update Jellyfin Media Server on Ubuntu

Updating Jellyfin Media Server is similar to updating any other package on your system, and you can use the standard apt commands.

To check for updates, run the following command:

sudo apt update

If there are any updates available, run the upgrade command:

sudo apt upgrade

Remove Jellyfin Media Server From Ubuntu

If you no longer require Jellyfin, you can easily remove it from your system. Use the following command to remove the software:

sudo remove install jellyfin --purge

Next, remove the Jellyfin repository from your system so you don’t accidentally reinstall it in the future:

sudo rm /etc/apt/sources.list.d/jellyfin.list

And that’s it. You have successfully removed Jellyfin from your system.


In conclusion, Jellyfin is a free, open-source media server that allows you to organize, stream, and access your media files from anywhere. Setting up Jellyfin on Ubuntu is a straightforward process that involves installing the necessary dependencies, configuring Apache or Nginx as a reverse proxy, and securing the server with an SSL certificate. With Jellyfin, you can access your media content from a web browser, mobile device, or smart TV, making it an ideal solution for home media streaming. Following the steps outlined in this guide, you can get Jellyfin up and running on your Ubuntu server in no time.

Your Mastodon Instance
Share to...