Setting up a media server (Jellyfin) and making it securely accessible from anywhere in the world

Fabrice
7 min readNov 30, 2022

--

Ever wondered how it’d be if you could access all of your media, and by all, I mean ALL of it. I mean movies, music, internet radios, books, comics, TV shows and live TV !

Interested ? Then let’s take a closer look on how we can achieve that !

In this step-by-step tutorial, we’ll be using Jellyfin, a free software media system. Other popular platform include Plex and Emby, but we won’t be talking about those in here.

First off, let’s talk about what you need :

  • A Desktop or Laptop (Nothing powerful needed, just take that old PC you left in the closet a few years ago, it’ll be just fine !)
  • A stable internet connection
  • A domain name (More on that requirement later)

Now that you have a working computer on hand, time to get working !

You have a few options now :

  • If you are using an old computer and you don’t have any valuable data on it, I’d recommend installing Ubuntu Server 22.04 (from here) on it ! It barely takes any space and is pretty fast compared to Windows and it’s free. Please note that if you had Windows or another OS on the computer, Ubuntu will wipe everything during the install !
  • If you are using a computer running Windows that has data you want to keep and you can’t just back it up for some reason, you can just use Windows, but steps may differ and this tutorial is intended for Ubuntu users, so do so at your own risk !

Assuming you now have your Ubuntu PC up-and-running, let’s now install Jellyfin on it ! (The steps below are for Ubuntu, check the documentation for Windows and others)

The Jellyfin team provides an Ubuntu repository for installation on Ubuntu Bionic, Focal, Impish, and Jammy. Supported architectures are amd64, arm64, and armhf.

  1. Install curl and gnupg if you haven't already:
sudo apt install curl gnupg

2. Enable the Universe repository to obtain all the FFMpeg dependencies:

sudo add-apt-repository universe

If the above command fails you will need to install the following package software-properties-common. This can be achieved with the following command sudo apt-get install software-properties-common

3. Download the GPG signing key (signed by the Jellyfin Team):

sudo mkdir /etc/apt/keyrings
curl -fsSL https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release )/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg

4. Add a repository configuration at /etc/apt/sources.list.d/jellyfin.sources:

cat <<EOF | sudo tee /etc/apt/sources.list.d/jellyfin.sources
Types: deb
URIs: https://repo.jellyfin.org/$( awk -F'=' '/^ID=/{ print $NF }' /etc/os-release )
Suites: $( awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release )
Components: main
Architectures: $( dpkg --print-architecture )
Signed-By: /etc/apt/keyrings/jellyfin.gpg
EOF

5. Update APT repositories:

sudo apt update

6. And finally, install Jellyfin:

sudo apt install jellyfin

If you had any issues with the above, check out the documentation at https://jellyfin.org/docs/general/administration/installing#ubuntu

Now, you’ll want to configure the basic settings of your new Jellyfin instance !

To do this, you’ll need your Internal server IP, which you can find by typing the command below in the command line :

hostname -I

This should give you something like 192.168.1.X or 10.0.2.X, or other numbers in similar forms.

Now, from any device connected to the same network as your server, type [the IP you got from the command above]:8096 in your search bar, and you should have a beautiful Jellyfin instance just waiting to be configured ! Change the settings that look more adapted to your needs, and leave everything else on default.

Now that the media server is officially up-and-running, we will now make it accessible from anywhere in the world ! For that, we’ll use a service called Cloudflare tunnel, but first, you will need a domain name. These can cost from 2–3$ up to 20$ a year (or much more on rare domains) depending on the name and extension you choose. For the best prices, I’d recommend checking out tld-list. There are sites selling free domains as well, but these domains usually only stay free for a year.

Once you are done buying your domain, we have to make it point to your media server ! For that, we’ll be using Cloudflare !

You can head over to Cloudflare, and create an account or log in by clicking the adequate button on the top right as shown here :

A screenshot of where to click to log in or signup.
A screenshot of where to click to log in or signup.

Once you finish with the signup/log in process, you should get to this screen :

You can then click on “Add a site” and follow the steps to add your domain to Cloudflare ! Once you are done making the necessary configurations, you will need to wait up to a day or two to finish the process. You should receive an e-mail when it’s done !

Now that our domain is connected to Cloudflare, we will make it point to our server ! But before that, we will just configure some security settings in advance. Head over to Cloudflare, and select your domain.

Then, go to SSL/TLS and Overview on the right of your screen.

Now, simply change the encryption mode to “Full (Strict)”, with that, the data will be safe with encryption between the device you’re playing media with and your server !

Now that this is done, let’s connect Cloudflare to our server. First off, head to your Cloudflare dashboard, and click on “Zero Trust”. This is a special panel with features we need.

It should load for a few seconds, then ask you to choose a team name, just put whatever you like, we won’t use it, so it doesn’t matter if you don’t remember it.

Screenshot of the “Choose your team name” screen, courtesy of NoobQuestions

If it asks you if you want to upgrade your plan, just stay with the free one.

Once you arrive on your dashboard, head to “Access” then “Tunnels” on the left of your screen.

Once you are on the Tunnels page, hit “create a tunnel”.

You will be asked for a name, which you should try to keep simple.

Now that you are on the “Install Connector” page, which will connect the Jellyfin computer to Cloudflare, you should head over to the computer which will be running Jellyfin, and follow the steps for your platform.

Once you got this step done, You will specify on what website you want to access your computer from, and what do you want to access, in our case Jellyfin. For that, select your domain, and add a subdomain or path if you wish to do so. Then, on the service part, select “HTTP” in the Type setting and put localhost:8096 as the URL, make sure not to put HTTPS or else it won’t work ! If you are worried about security, don’t worry since this data will be encrypted in HTTPS anyway when it gets out of the computer.

Then, hit “Save”, and you should be sent back to the tunnel screen, with your tunnel marked as active ! You can now access your Jellyfin website from anywhere in world by going to the (sub)domain you set in the dashboard !

IMPORTANT NOTE :

I’ve been using this config for some time now, and the only issue I’ve ran in is Jellyfin becoming really laggy and sometimes refusing to load media. That happens rarely, but it happens, to fix it on Ubuntu, run

sudo apt-get update
sudo apt-get upgrade

to update all the packages, and then reboot by running

sudo reboot

If you have any questions or issue, don’t hesitate to ask them in the comments, I will do my best to help and update this guide regularly. If you think a guide on adding media to Jellyfin would be useful, or maybe advanced configuration, etc.. just write it in the comments too and like the suggestions you like.

Cheers,

Have a good one.

--

--