An Ubuntu Media Server Running Jellyfin
by 8-bit-boy in Circuits > Computers
110 Views, 0 Favorites, 0 Comments
An Ubuntu Media Server Running Jellyfin
The goal for this project was to re-use an old Dell laptop as a media server running jellyfin to stream the movies on my hard drive. The results were better than I expected and I might go for an improved version if I find a laptop with improved specs.
Supplies
The only supplies needed for this project are :
- An old laptop
- The laptops charger
- A hard drive with movies and or TV shows
There are some additional components that I used to improve the laptop that I used , but these are optional depending on the specs of your chosen computer :
- One 8-GB sticks of RAM
- One 4-GB stick of RAM
- A 1 TB hard drive (HDD)
Download UBuntu Server
The first step was to install ubuntu server onto the latptop, I downloaded the ubuntu server ISO file from the official Ubuntu site https://ubuntu.com/download/server . Specifically the Ubuntu 26.04 LTS version and the Intel or AMD 64-bit architecture.
Flash the OS
The OS then needs to placed onto a USB drive in order to be used as a booting device. I used a 8GB MSF USB stick. I used a an app called rufus, it formats and creates bootable USB drives. Plug in your drive and select the Ubuntu .ISO file and be sure to select the MBR partition scheme and FAT32 file system. Press start and the drive will be ERASED and the Ubuntu server OS loaded. (NB:The image for this step is of Rufus but just of a different OS being loaded , so ensure that you load the correct one)
Upgrade Laptop Hardware(optional)
This step is optional if your laptop already has at least 8 GB of RAM and a sufficiently powerful CPU . I upgraded my laptops RAM and hard drive by adding a 8 GB stick of RAM , giving 12 GB of total RAM, and added a 1 TB HDD . I never evaluated the systems performance before the upgrade , so this may very well have been unnecessary.
Install Ubuntu Server
I next booted the OS onto the laptop using the flashed USB stick. Firstly you connect the USB stick to the laptop while it is off and then turn on the computer while holding down the shift key (may be F2 , F12 , ES or DEL on a different laptop). Once in the menu;
I left most of the options in their defaults as I would configure in the Ubuntu server terminal. But you must select to install "using the entire disk" and enable OpenSSH on the device so that we can access the server from another device.
Once complete , you should be greeted with a plain command line (no friendly UI unfortunately) and you must enter your login and password details.
Disabling the Screen(optional)
At the time , I saw no benefit in keeping the screen enabled as we could fully control the system using SSH.
In order to disable the screen were going to disable 'sleep when the lid is closed' (lid switch is triggered) , that way we can close the screen and still keep the system running.
The commands for disabling the lid switch are as follows :
sudo nano /etc/systemctl/logind.conf
This takes you to the configuration file where we can edit the lid switch settings. This command may not work for some laptops (as the case with my HP laptop) because the directory may be different so you must google or consult with your preferred AI model to find out the exact directory for your system. The next step is to edit the following lines as follows(replacing the previous terms with 'ignore'):
HandleLidSwitch=ignore
HandleLidSwitchDocked=ignore
The service is then restarted using the following command
sudo systemctl restart systemd-logind
Disabling the screen was rather inconsistent, as it often would not respond as intended and shut down the server when the lid was closed. So I would not really recommend this unless you intend on running the system for long periods of time and would be irritated by the light.
Start on AC Power Enable
To ensure that the media server doesn't crash on every power outage , we have to enable "restart on AC". This is done by first entering the BIOS,
sudo restart
While the system is restarting , hold the shift (differs for different laptops) key while the system restarts and you should enter the BIOS. Navigate to the Advanced settings and under Powerflow (could have a different name on other systems). Enable power on AC and save your changes under the EXIT tab.
Connecting to the Internet
As we did not connect to the internet during the installation process , we have to do this now in order to install Jellyfin. I tried connecting to my Universities network but this failed , most likely due to all the security measures in place on the network. I instead manged to connect my computer to my phones network (hot spotting). The first step is to edit the netplan comfiguration:
sudo nano /etc/netplan/00-installer-config.yaml
I then edited the file by typing in the following infomation:
network:
--version: 2
--wifis:
----wlan0:
------dhcp4: true
------access-points:
-------"YourPhoneHotspotName":
---------password: "YourPassword"
NB: The dashes '-' are there to indicate space and should NOT be included in the entries.
The indentations between lines must be the same otherwise this may not work. We then apply the configuration
sudo netplan apply
You can confirm if it worked by trying to install a package like we will with jellyfin or by running
sudo apt update
and checking the output.
Installing Jellyfin
Jellyfin is the service that runs on our server and gives us a convineint way of connecting devices to our it and managing our movies and shows. To install it we first add the repository:
curl https://repo.jellyfin.org/install-debuntu.sh | sudo bash
if curl is not yet installed , install it using
sudo apt install curl
Then run
sudo apt update
sudo apt install jellyfin
To enable then run jellyfin:
sudo systemctl enable jellyfin
sudo systemctl start jellyfin
if you want to check the status of the service,
sudo systemctl status jellyfin.service
Loading the Hard Drive
In order for the server to send our media to jellyifn , we have to mount the drive onto our our system. Connect the drive to the laptop and the first command to run is the :
lsblk
which will list all drives on the system. Next we mount the drive with
sudo mount /dev/sdb1 /mnt/media
the spaces are important otherwise the command will not be recognised. To confirm if the drive is mounted we run:
ls /mnt/media
You should see all your movies and shows in this directory. The next step is to get the UUID (Universally Unique Identifier) of the drive. We then edit the fstab to change how the mount is shared:
sudo blkid
sudo nano /etc/fstab
We then add a new default with
/UUID= <The UUID you got> /mnt/media ntfs-3g defaults 0 2
Again be mindful of the spaces between characters.
There may be some issues regarding permissions , but these can be resolved with
sudo chown -R jellyfin:jellyfin /mnt/media
sudo chmod -R 755 /mnt/media
Accessing Jellyfin
in order to accesss jellyfin we have to use the browser but with a very specific adress. This address can be obtained by running
hostname -I
Then on a seperate computer , your going to have to type in the following address
http://<your IP>:8096
Ensure that the two computers are on the same wifi network. Once your on the login page for Jellyfin , you'll have to create a login and password. Once in , you should create a library and add a folder with the same name/directory as used in the previos step, in this case,
/mnt/media
Then upload your movies and shows onto the library through the dashboard.
Installing SSH
To control the server from another computer we'll have to install and enable SSH on it.
The first commands to run are to install OpenSSH:
sudo apt update
sudo apt install openssh-server
then we enable it:
sudo systemctl enable ssh
and finally start the service
sudo systemctl start ssh
To ssh into your server , we first need its ip address
ip a
Then run :
ssh <the servers login name>@<your servers ip address>
You'll then have to confirm the connection and enter your password (server password). But once complete you'll have access to your server from your second computer!!
sudo echo "Hello World!!" | wall
and check your server's screen!
Possible Error: Incorrect Time Error
If you fail to connect the server to the internet, check if the time is correct on the system,
timedatectl
The local time should match the correct time within your region , while the Universal and RTC time may lag behind but must match each other . Also check if the time zone is correct as this can lead to connection failures as well. To make changes to the system time:
sudo timedatectl set-timezone <your regions time zone , e.g. Africa/Johannesburg>
Then we enable automatic time sync,
sudo timedatectl set-ntp true
NB: if network issues persist , depending on your local network you can try fixing the IP address of your server on your modem's dashboard. Or seeing if the network is blocking the servers IP address.
Possible Error: Playback Error
If you try to play a movie or show on jellyfin and run into a "playback error" , you should try the followoing fix
sudo apt install ffmpeg
ffmpeg is a package for handling video streams. Then we restart the jellyfin service
sudo systemctl restart jellyfin
Possible Error: Missing Permission Issue
if you run into errors regarding the permissions surrounding the jellyfin service , you have to change ownership to jellyfin, first mount the drive
sudo mount /dev/sdb1 /mnt/media
then check if it worked
ls /mnt/media
Then we change ownership to jellyfin
sudo chown -R jellyfin:jellyfin /mnt/media
Possible Error: Unplugged Drive
If your drive happens to get disconnected , you have to then re-mount the drive(every time). This can be done with the following command,
sudo mount /dev/sdb1 /mnt/media
then restarting the jellyfin service should get your server back on track
sudo systemctl restart jellyfin.service