This guide builds the server described in A home media server stack, reviewed, from a spare computer to a film playing on your TV. It uses home-media-server, which is exactly what my own server runs, and a setup script that does the fiddly parts for you.
It comes in parts. Part 1 gets Jellyfin working at home, and is all you need to start. Every part after it is optional and can wait until you want it.
In this guide:
- Before you start
- Part 1: Jellyfin at home
- Optional: pooling several drives
- Part 2: Watching away from home
- Part 3: Requests and downloads
- Part 4: Monitoring, alerts and backups
- Part 5: Shared folders
- Advanced: AWS
- If something isn't working
- Keeping it up to date
- What this doesn't do
Before you start
You need:
- A computer to be the server, left on all the time, with Ubuntu installed (other Linux systems work, but the commands here are Ubuntu's). An old desktop is fine. One with an Intel processor that has built-in graphics can convert video faster (why that matters).
- Your films and shows on a drive in, or plugged into, that computer.
- An hour or so for Part 1, and a little patience with a terminal.
Every command in this guide runs on the server, in its terminal, or from another computer connected to it over SSH. When a command contains something in angle brackets, replace it with your own value:
| You'll see | Replace it with | How to find it |
|---|---|---|
<server-address> |
The server's address on your home network, like 192.168.1.20 |
hostname -I on the server (the first one) |
/mnt/media |
The folder that holds your films and shows | Wherever your media drive is mounted (lsblk -f) |
yourname.duckdns.org |
Your web address, if you set one up in Part 2 | You choose it on DuckDNS |
Part 1: Jellyfin at home
1. Install Docker and Git. Docker runs each app in its own ready-made package, called a container. Follow Docker's instructions for Ubuntu, then install Git and check Docker works:
sudo apt install git
sudo docker run hello-world # should print "Hello from Docker!"
2. Put your media in one folder, with a folder for each kind inside it. Jellyfin and the other apps will look for them there:
mkdir -p /mnt/media/Movies /mnt/media/TV
If that says "Permission denied", the folder belongs to the system rather than you; take it over
with sudo chown "$USER": /mnt/media and try again.
If your media is spread over several drives, you can join them into one folder first: see Optional: pooling several drives below, then come back.
3. Download the repo and run the setup script. The first run creates your settings file,
.env, with your user, time zone and folders already filled in, then stops:
git clone https://github.com/RaymanRJ/home-media-server.git ~/home-media-server
cd ~/home-media-server
./setup.sh
Open the settings file with nano .env and change two lines (save with Ctrl+O, Enter, then Ctrl+X):
MEDIA_POOL=/mnt/media
COMPOSE_PROFILES=
MEDIA_POOL is your media folder. COMPOSE_PROFILES lists the optional parts to run; empty means
Jellyfin alone, which is all Part 1 needs. Then run the script again, for the media apps only:
./setup.sh --start media
It creates each app's folders, checks your settings, and sets the media apps to start whenever the
server boots. You should see Started., then a note that monitoring and Samba aren't set up yet:
that's expected, they come in Parts 4 and 5. (./setup.sh --dry-run media shows what it
would do without doing it.)
4. Set up Jellyfin. On any computer or phone at home, open http://<server-address>:8096.
Jellyfin's setup asks for:
- An admin account: the login you'll manage it with.
- Libraries: add one for films, with the folder
/media/Movies, and one for shows, with/media/TV. Jellyfin sees your media folder as/media.
Jellyfin can only read your media folder, never change it, so nothing it does can damage your files.
You should now: see your films and shows in Jellyfin, and be able to play one. Install the
Jellyfin app on your TV or phone and connect it to http://<server-address>:8096.
Optional, faster video conversion: if a device can't play a file as it is, Jellyfin converts it while you watch. A processor's built-in graphics do that far better than the processor alone. To let Jellyfin use them:
cd ~/home-media-server
cp stacks/media/compose.override.example.yaml stacks/media/compose.override.yaml
getent group render # the number after "render:x:" is your group number
Put that number in the group_add line of stacks/media/compose.override.yaml, run
./setup.sh --start media again, and in Jellyfin go to Dashboard > Playback > Transcoding: choose
Video Acceleration API (VAAPI) and the device /dev/dri/renderD128. Tick hardware decoding for
H264 only, unless you know your chip handles more;
Tuning Jellyfin on an old server shows how to check.
Optional: pooling several drives
If your media is on several drives, mergerfs can show their folders as one, without moving or reformatting anything. Each file stays whole on one drive, so if a drive dies you lose only what was on it. This step changes how the server starts up, so go carefully.
Install it with
sudo apt install mergerfs, and list your drives withlsblk -f. Note each media drive's UUID, a long ID that never changes (unlike names likesdb), and its FSTYPE, such asext4.Open the file that lists what to mount at startup,
sudo nano /etc/fstab, and add a line for each drive, using its UUID and type:UUID=<drive-1-uuid> /mnt/<drive-1-uuid> ext4 defaults,nofail 0 2 UUID=<drive-2-uuid> /mnt/<drive-2-uuid> ext4 defaults,nofail 0 2Mount the drives, and give each one a
mediafolder that belongs to you. Move what's already on a drive into itsmediafolder; on the same drive, that's instant.sudo mkdir -p /mnt/<drive-1-uuid> /mnt/<drive-2-uuid> /mnt/media sudo systemctl daemon-reload && sudo mount -a sudo mkdir -p /mnt/<drive-1-uuid>/media /mnt/<drive-2-uuid>/media sudo chown "$USER": /mnt/<drive-1-uuid>/media /mnt/<drive-2-uuid>/mediaAdd one more line to
/etc/fstabfor the pool. It must stay on one line:/mnt/<drive-1-uuid>/media:/mnt/<drive-2-uuid>/media /mnt/media fuse.mergerfs allow_other,cache.files=off,dropcacheonclose=true,category.create=mfs,moveonenospc=true,minfreespace=50G,fsname=mergerfs,nofail,x-systemd.requires-mounts-for=/mnt/<drive-1-uuid>,x-systemd.requires-mounts-for=/mnt/<drive-2-uuid> 0 0Mount it, and check:
sudo systemctl daemon-reload && sudo mount -a ls /mnt/media # both drives' media folders, as oneA mistake in
/etc/fstabcan stop the server from starting.nofailon every line prevents most of that, andsudo mount -ashows errors now rather than at the next reboot.
The pool's line is long because the file allows only one line per mount. It has four parts, separated by spaces:
| Part | Means |
|---|---|
/mnt/<drive-1-uuid>/media:/mnt/<drive-2-uuid>/media |
What to join: each drive's media folder, separated by : |
/mnt/media |
Where the joined folder appears |
fuse.mergerfs |
Which tool does the joining |
allow_other,... |
How it behaves, below. The 0 0 at the end means no backups by dump and no disk check at startup |
| Option | What it does |
|---|---|
allow_other |
Lets every user on the server use the pool, including the apps in Docker |
cache.files=off, dropcacheonclose=true |
Leave file caching to the drives themselves, so the same data isn't held in memory twice |
category.create=mfs |
Put each new file on the drive with the most free space |
moveonenospc=true |
If a drive fills up while a file is being written, move the file to another drive and carry on |
minfreespace=50G |
Never put a new file on a drive with less than 50 GB free |
fsname=mergerfs |
The name the pool shows in lists of drives (df) |
nofail |
Start the server even if the pool can't be mounted |
x-systemd.requires-mounts-for=... |
Wait for each drive to be mounted before joining them, one per drive |
Only the media folders are joined, not the whole drives, so anything else on them stays out of
Jellyfin. The setup script also makes the media apps wait for the pool, so Jellyfin never starts
against an empty folder.
Part 2: Watching away from home
There are two ways, and you only need one.
Tailscale: the simplest, and private. Tailscale is an app that connects your devices to each other securely, wherever they are, with nothing to change on your router. Install it on the server:
curl -fsSL https://tailscale.com/install.sh | sh
sudo tailscale up # follow the link it prints to sign in
Then install the Tailscale app on each phone, tablet or computer that should watch, signed in to
the same account (or invited to it). Jellyfin is then at http://<server-name>:8096 from anywhere,
where <server-name> is the server's name in the Tailscale app. It's free for personal use; the
catch is that everyone who watches needs the app and an invitation.
DuckDNS and HTTPS: a web address anyone can open. A free address like
https://yourname.duckdns.org with a real security certificate, which works in any browser or the
Jellyfin app, with no extra app.
Sign in at duckdns.org, add a subdomain (the
yournamepart), and copy your token from the top of the page.In
.env:COMPOSE_PROFILES=https,duckdns JELLYFIN_DOMAIN=yourname.duckdns.org DUCKDNS_SUBDOMAIN=yourname DUCKDNS_TOKEN=<your token>duckdnskeeps your address pointing at your home, even when your internet provider changes your home IP.httpsturns on Caddy, which gets the certificate and renews it by itself.On your router, give the server a fixed address (often called a DHCP reservation), and forward ports 80 and 443 to it. Router menus differ; the repo's router notes show where these are on one make.
Run
./setup.sh --start media, and watch Caddy get its certificate:sudo docker logs -f caddy(wait for "certificate obtained successfully"; Ctrl+C to stop watching).In Jellyfin, Dashboard > Networking > Known proxies:
127.0.0.1. Visitors now arrive through Caddy, and without this Jellyfin thinks everyone is at home.
You should now: open https://yourname.duckdns.org on a phone using mobile data, not your
home Wi-Fi, and see Jellyfin's sign-in page with a padlock. At home, your router can make things
work that don't work for anyone else, so always test from outside.
Opening ports makes Jellyfin reachable by anyone on the internet, so give every account a strong
password. If it doesn't work from outside at all, your internet provider may share one public
address between many homes (called CGNAT): if your router's outside address doesn't match what
curl ifconfig.me shows on the server, use Tailscale instead.
Part 3: Requests and downloads
This part adds the apps that find, download and file films and shows for you, and Seerr, the page where people ask for them. What each one does is in A home media server stack, reviewed. Only download what you have the right to.
Turn them on. Add downloads to COMPOSE_PROFILES in .env (for example
COMPOSE_PROFILES=downloads,https,duckdns), and start the media apps again. The script also
creates a downloads folder in your media folder, owned by you so the apps can write to it:
./setup.sh --start media
Then set the apps up in this order, because each one needs the one before. Each has its own
page at http://<server-address>:<port>, and asks you to create a login the first time.
qBittorrent (port
8081), the downloader. Its first password is insudo docker logs qbittorrent; change it under Tools > Options > Web UI. In Tools > Options:- Downloads: Default Save Path
/media/downloads. - Connection: port
6881, and untick UPnP / NAT-PMP, so it can't open ports on your router by itself. - BitTorrent: stop seeding at a ratio of 1, or after 1440 minutes, then Stop torrent.
- Downloads: Default Save Path
Sonarr (port
8989, for shows) and Radarr (port7878, for films). In each:- Settings > Media Management: turn renaming on, and under Root Folders add
/media/TV(Sonarr) or/media/Movies(Radarr). Click Show Advanced at the top to see Use Hardlinks instead of Copy, and leave it on. - Settings > Download Clients: add qBittorrent, host
qbittorrent, port8081, with its username and password. - Settings > Connect: add Emby / Jellyfin, host
host.docker.internal, port8096, with an API key made in Jellyfin (Dashboard > API Keys), so Jellyfin shows new arrivals straight away. - Settings > General: copy the API key. Put Sonarr's in
.envasSONARR_API_KEYand Radarr's asRADARR_API_KEY.
- Settings > Media Management: turn renaming on, and under Root Folders add
Prowlarr (port
9696), which searches for Sonarr and Radarr. In Settings > Apps, add Sonarr (http://sonarr:8989) and Radarr (http://radarr:7878) with their API keys, and leave the Prowlarr server ashttp://prowlarr:9696. Then add the sites you want to search under Indexers. Choosing them is up to you; this guide doesn't recommend any. If one fails with a Cloudflare error, add a FlareSolverr proxy in Settings > Indexers (hosthttp://flaresolverr:8191/, tagflaresolverr) and give that site the same tag.Recyclarr sets Sonarr's and Radarr's rules for choosing a version, from the TRaSH Guides. With the two API keys in
.env:./setup.sh --start media sudo docker exec recyclarr recyclarr syncBazarr (port
6767), for subtitles. In Settings, connect Sonarr (hostsonarr, port8989) and Radarr (hostradarr, port7878) with their API keys, choose your languages, and add subtitle providers (OpenSubtitles.com needs a free account).Seerr (port
5055), the request page. Its setup asks you to sign in with Jellyfin (serverhost.docker.internal, port8096), choose libraries, and add Radarr and Sonarr (hostsradarrandsonarr, with the same root folders as above). Then, under Users, import your Jellyfin users and choose who's approved automatically.Cleanuparr (port
11011) removes downloads that are stuck or fake, so Sonarr and Radarr try another. Connect qBittorrent, Sonarr and Radarr, and leave Dry Run on for the first few days: it then only reports what it would remove.
Seerr from away from home (only if you set up DuckDNS in Part 2): add
SEERR_DOMAIN=requests.yourname.duckdns.org to .env and run ./setup.sh --start media. In
Seerr's Settings > General, set the Application URL to that address and turn on Enable Proxy
Support and Enable CSRF Protection. In Settings > Users, turn Enable Local Sign-In off,
so only Jellyfin accounts can sign in.
You should now: request a film you have the right to download, such as a public-domain one, in Seerr. It shows up in Radarr's Activity page while it downloads, and in Jellyfin when it's done.
Two things make this work smoothly, and are already set up for you: every app sees your media at
the same place (/media), so when qBittorrent says a download is finished, Sonarr finds it at
exactly that path; and Sonarr and Radarr see the whole media folder at once, so they can file a
download instantly, without copying it.
Part 4: Monitoring, alerts and backups
This part watches the server, emails you when something's wrong, and backs up your settings every night. What each piece does is in Monitoring a home media server.
1. Email (optional, but most of this part uses it). Any email account works. With Gmail, make
an app password, then put this in .env, with your
address and app password (%40 stands for the @ in your address):
SMTP_URL=smtp://you%40gmail.com:APP_PASSWORD@smtp.gmail.com:587/?from=you@gmail.com&to=you@gmail.com
2. Tell it about your drives, so it can check their health:
cp stacks/monitoring/compose.override.example.yaml stacks/monitoring/compose.override.yaml
ls -l /dev/disk/by-id/ # each drive's ID, by model and serial number
In the new file, list each drive under scrutiny by its ID, and under beszel-agent and
weekly-report by its folder, as the examples in it show. Delete the parts you don't need.
3. Start the monitoring apps:
./setup.sh --start monitoring
4. Set up Beszel (port 8090), the server dashboard. Create an account, then Add system:
any name, the host <server-address> (not localhost), and port 45876. Copy the key and
token it shows into .env as BESZEL_AGENT_KEY and BESZEL_AGENT_TOKEN, and run
./setup.sh --start monitoring again. The server then appears in Beszel with live charts. Under
Settings > Notifications, add your email and choose what should alert you.
5. Scrutiny (port 8080) needs nothing else: it shows each drive's health and emails you if
one looks likely to fail. It has no login, so never make it reachable from outside your home.
6. The nightly backup copies every app's settings, Jellyfin's watch history and your .env to
a shared folder on another device, such as a NAS. In .env, set BACKUP_SHARE to that folder
(for example //nas.local/Public; if it needs a login, also set BACKUP_SHARE_OPTS to
username=<name>,password=<password>), RESTIC_PASSWORD to a long password, and JELLYFIN_API_KEY to
a key from Jellyfin's Dashboard > API Keys. Keep the password somewhere else too: without it the
backup can't be read. Then run ./setup.sh --start monitoring, which turns the nightly backup on,
and run one now to check it works:
sudo systemctl start media-backup.service
journalctl -u media-backup.service -n 20 # should end without errors
Your films and shows themselves aren't backed up; that would mean a second set of drives.
7. The weekly report is a Monday-morning email about the past week. It turns on once
SMTP_URL and JELLYFIN_API_KEY are both set, and needs Jellyfin's Playback Reporting plugin
(Dashboard > Plugins > Catalog) for its viewing figures.
8. Knowing when the server is offline. Everything above runs on the server, so it goes quiet if the house loses power. A free service like UptimeRobot can open your web address every few minutes and email you when it stops answering.
The watchdog is already running: if an app stops responding, it restarts it, and emails you if email is set up.
Part 5: Shared folders
Samba shares a folder with the Macs, Windows PCs and phones in your house, like a network drive.
It shares the folder ~/share in your home folder, which the script creates (to share another
one, change SAMBA_SHARE_DIR in .env). Install the service that lets Macs and phones find the
server by name, start Samba, and set the password people will use to connect. The user name is
your own:
sudo apt install avahi-daemon
./setup.sh --start samba
sudo docker exec -it samba smbpasswd -a "$(id -un)"
You should now: see the server under Network in a Mac's Finder, or open \\<server-address>
in Windows File Explorer. The story behind this part is in
Samba in Docker.
Advanced: AWS
Everything above works without a cloud account. If you're comfortable with AWS and Terraform, the
repo's terraform/ folder adds three things instead of the free options:
- Your own domain instead of DuckDNS, kept pointing at your home without a stored password.
- Email through Amazon SES, from your own domain, instead of Gmail.
- An outside check that emails you when the site goes down, and the one feature with no free alternative: a "we're offline" page visitors see while your house is unreachable.
It costs about nothing, but needs an AWS account, a domain in Route 53, that domain set up for sending email in SES (verified, with its DKIM, SPF and DMARC records), a storage bucket for Terraform's records, and Terraform itself. The steps are in the README's AWS section.
If something isn't working
- See what's running:
sudo docker ps. Every app should say(healthy)within about five minutes of starting; one that says(unhealthy)or keeps restarting has a problem. - Read an app's log:
sudo docker logs <name>, for examplesudo docker logs jellyfin. - Check the setup:
./setup.sh --dry-runshows what it would change, and stops with a message if.envhas a mistake. - "Permission denied" in a log usually means a folder belongs to
rootinstead of you. Fix it withsudo chown -R "$USER": <the folder>, then./setup.sh --startagain. - Caddy can't get a certificate: check ports 80 and 443 are forwarded, and that nothing else on
the server uses them (
sudo ss -tlnp '( sport = :80 or sport = :443 )'should list only Caddy).
Keeping it up to date
cd ~/home-media-server && git pull && ./setup.sh --start
Without a stack's name, ./setup.sh --start restarts every part you've set up so far.
Each app is pinned to a version, so nothing changes until the repo moves it, and you choose when to pull. Before a big Jellyfin update, read its release notes: a new version can upgrade its database for good, and the nightly backup is your way back.
What this doesn't do
- One computer, no spare. A dead drive loses its files, and a dead server takes everything down until it's replaced. The backup covers settings and watch history, not the films and shows.
- No VPN on downloads. Everyone sharing a file can see your home's internet address. Only download what you have the right to.
- No "we're offline" page without the AWS setup: while the house is down, visitors just see that the site can't be reached.
- It's my setup, shared as it is. It's tested on one server, mine, and you're welcome to change it to suit yours.
