← Teacher guide

Host Jellyfin, a media server

Jellyfin serves your films and music to any device on the network, through a web page on port 8096. It runs as its own user, so it can only read files that user is allowed to read. A firewall decides which ports can be reached.

System admin on a Raspberry Pi · Serve · about 40 minutes · Open the student lesson

Classroom resources

Open these in Waypoints Prepare with one click. To share a file another way, copy its address and paste it into Load URL, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.

Students will be able to

Timing

Predict and Try 8 min · Worked example 10 min · Vary 10 min · Practise and Make 12 min

Before class

Try the boards yourselves.

The one idea: a service runs as a user and gets only that user's rights; a firewall decides which ports can be reached. This links permissions (lesson 3) and ports (Networks).

Simplifications: the pretend Pi has Jellyfin in its apt list. A real Raspberry Pi OS does not: add Jellyfin's own repository first (see jellyfin.org install page), which downloads a key, and then sudo apt install jellyfin. Jellyfin also asks for a first-run setup in the browser (an admin account, a library folder). The board shows only what matters for the lesson.

Taught: Jellyfin (free, open source, no account). Other options to name: Plex (free to play your own media; some features need a Plex account or a paid Plex Pass), Emby (some features need a licence), Kodi (plays on one device, not a server). On a Pi, transcoding (changing a video's format on the fly) is slow, so use files the devices can play directly.

With internet: metadata (posters, descriptions) is fetched from the internet. Reaching your server away from home should use a VPN (Tailscale or WireGuard), not an opened router port: an open port is scanned within minutes.

Running the lesson

  1. Predict: wrong answers think a service is all-powerful.
  2. Try: ask which of the listed ports is which.
  3. Worked example: stop at the library bug and ask whose permissions apply.
  4. Vary: after the firewall task, ask what else is blocked.
  5. Make: ask what would make this unsafe to put on the internet.

In class

On the slides at these points. Students can do the whole lesson on their own; these are for the room. In the deck, the Run, Modify and Make slides have the live playground in them (the tutorial link is the backup), and the notes above are in each slide's speaker notes.

The hard part (on purpose)

Seeing the service as a user. Ask: whose account runs it, and what may that account read?

When students get stuck

What you will seeA question to askThe fix
Jellyfin finds no films.Who owns the folder? Can the jellyfin user open it?Move the films to /srv/media.
Other devices cannot connect.Is the service running? Is the port allowed?systemctl status jellyfin, sudo ufw allow 8096.

Answers to the checks

  1. private films: Jellyfin runs as its own user, jellyfin. Your film is in /home/pi/Videos, and your home folder is private (drwx------). Can Jellyfin see it?
    No. A service has no special powers. Put the films where its user may read them, for example /srv/media.
  2. Try: install and look: Install jellyfin (the lists are already up to date), then run ss -tln to see which ports have a service.

    sudo apt install jellyfin starts the service. ss -tln lists listening ports: 8096 is Jellyfin.
  3. Where the films go: Which port does Jellyfin's web page use?
    8096
    Devices open http://raspberrypi.local:8096 in a browser. The number after the colon is the port.
  4. Find the mistake: Sam's library is empty. Click the line where it first goes wrong.
    line 2
    Line 2: a private home folder keeps other users out, and Jellyfin is another user. Reinstalling changes nothing. Move the films to /srv/media.
  5. Other options: Which of these plays media only on the one device it is installed on, rather than serving other devices?
    Kodi
    Kodi plays on one device. Jellyfin, Plex and Emby serve to many; Jellyfin is free and open source with no account.
  6. Move the film: Move /home/pi/Videos/holiday.mp4 into /srv/media so that jellyfin can read it.

    sudo mv /home/pi/Videos/holiday.mp4 /srv/media: /srv/media is not private.
  7. Open the door: The firewall is on and blocks everything. Let other devices reach Jellyfin on port 8096.

    sudo ufw allow 8096.
  8. Switch it off: Stop the Jellyfin service. Check with ss -tln that nothing listens on 8096.

    sudo systemctl stop jellyfin: no program, no listener.
  9. The port: A device opens http://raspberrypi.local:8096. What does the 8096 mean?
    The port: which service to talk to
    One Pi can run many services; the port picks which.
  10. Firewall: The firewall is on and nothing else is set. A TV tries port 8096. What happens?
    It is blocked
    A firewall lets in only what you allow.
  11. Review: restart: Review: you edited smb.conf. What else must you do?
    Restart smbd
    Services read their config when they start.
  12. a media server: Set up the media server: install Jellyfin, make holiday.mp4 readable by it, and let other devices reach port 8096.

    Install Jellyfin, move the film into /srv/media, allow 8096 in the firewall. That's the whole job.

Solutions

One possible solution for each task. Other correct programs are fine.

Vary: change one thing › Move the film

Open task: any program that does what the step asks.

Vary: change one thing › Open the door

Open task: any program that does what the step asks.

Vary: change one thing › Switch it off

Open task: any program that does what the step asks.

a media server

Open task: any program that does what the step asks.

Stretch and support

Stretch: Find out what transcoding is and why a Pi is slow at it.

Support: A card: the user, the folder, the port.

Exit ticket

Why might Jellyfin find no films in /home/pi/Videos?

It runs as the jellyfin user, and a private home folder keeps other users out.

What each step is for

Where it leads

Links: Networks (ports); Accounts, groups and sudo; Services; next: Keep it running.