Site icon Hackatronic

Build a Powerful and Affordable Raspberry Pi Media Server

Raspberry Pi Media Server

Raspberry Pi Media Server

If you want a compact, low-cost home media server that streams movies, TV shows, music, and photos to TVs, phones, and smart home devices, the Raspberry Pi 5 has become one of the best value-for-money platforms available. With its improved CPU performance, faster I/O capabilities, and support for NVMe storage, it stands out as a highly capable server for household media needs.
This guide walks you through hardware options, software choices, step-by-step setup, storage and networking guidance, performance tuning, security practices, and routine maintenance. By the end, you’ll have a reliable, quiet, and efficient media server that doesn’t strain your budget.

This guide offers two practical approaches:

Why use a Raspberry Pi 5 for a media server?

The Raspberry Pi 5 improves meaningfully on earlier Pi models, especially the Pi 4. Several core advantages make it well-suited for a 24/7 home media server:

Raspberry Pi 5 Specification
Raspberry Pi 5 Specification

Tradeoffs to be aware of

The RPi 5 is powerful for its size, but it is not a full desktop CPU and still has limitations:

For most homes, especially those with modern streaming clients, the Pi 5 performs extremely well.

Hardware Requirements of Raspberry Pi Media Server 

Core Components

Raspberry Pi 5 with M.2 SSD
Raspberry Pi 5 with M.2 SSD

Storage (critical for media hosting)

The Pi 5 introduces more storage options:

Option 1: NVMe SSD (best)

Using the official Raspberry Pi M.2 HAT, you can attach an NVMe SSD.
Advantages:

Option 2: External USB 3.0 SSD

Still an excellent option:

Storage Devices for Raspberry Pi Media Server
Storage Devices for Raspberry Pi Media Server

Option 3: USB HDD

Economical option with high capacity:

Networking

Cooling & case

The Pi 5 runs considerably hotter than the Pi 4.

Extra IO Devices

Choose Your Software for Media Server

Jellyfin
Free, open source, and highly capable. Excellent UI, strong metadata handling, and active development. Runs very efficiently on Pi 5.

Plex
Polished experience with superb client support. However, some features (especially hardware transcoding) require a Plex Pass.

Media Server Software
Media Server Software

Emby
Similar to Plex with a blend of free and paid features. Less common than Jellyfin.

Kodi / OSMC / LibreELEC
Great if you want the Pi itself to act as a media player instead of or in addition to serving media across your network.

Samba / NFS
Used for sharing media directories with other devices, or for manually copying media onto the server.

Docker
Strongly recommended for modular, future-proof setups: run Jellyfin, automation tools, reverse proxies, file sharing, and more in isolated services.

In this guide, Jellyfin serves as the primary media server example.

Simple & Reliable setup (Jellyfin + SSD/NVMe)

1) Prepare the OS

Download Raspberry Pi OS Lite (64-bit).
Flash using Raspberry Pi Imager or balenaEtcher.
Enable SSH during imaging or by placing an empty ssh file in the boot partition.

Boot the Pi and configure the basics:

sudo raspi-config
sudo apt update && sudo apt full-upgrade -y

In raspi-config, set hostname, timezone, locale, and expand the filesystem if necessary.

Security note

Change the default password immediately. Later, disable password-based SSH login and use SSH keys.

2) Connect and format your media drive

Identify your drive:

lsblk

Assume the device is /dev/nvme0n1 for NVMe or /dev/sda for USB.

Partition, format, and mount:

sudo parted /dev/sda --script mklabel gpt mkpart primary ext4 0% 100%
sudo mkfs.ext4 -L MEDIA /dev/sda1
sudo mkdir -p /mnt/media
sudo mount /dev/sda1 /mnt/media

Automatically mount at boot:

sudo blkid /dev/sda1
sudo nano /etc/fstab

Add:

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx  /mnt/media  ext4  defaults,noatime  0  2

Set ownership:

sudo chown -R pi:pi /mnt/media

3) Install Jellyfin (APT repo or Docker)

Option A — Install using APT (easiest)

sudo wget -O /usr/share/keyrings/jellyfin.gpg https://repo.jellyfin.org/debian/jellyfin_team.gpg.key
echo "deb [signed-by=/usr/share/keyrings/jellyfin.gpg] https://repo.jellyfin.org/debian bookworm main" \
| sudo tee /etc/apt/sources.list.d/jellyfin.list
sudo apt update
sudo apt install jellyfin -y

Enable service:

sudo systemctl enable jellyfin
sudo systemctl start jellyfin

Access:

http://<PI_IP>:8096

Self-hosting your Media with Jellyfin on the Raspberry Pi

Option B — Install Jellyfin using Docker (recommended)

Install Docker:

curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker pi

Install Composer plugin:

sudo apt install docker-compose-plugin -y

Create docker-compose.yml:

version: "3.8"
services:
  jellyfin:
    image: jellyfin/jellyfin:latest
    container_name: jellyfin
    ports:
      - 8096:8096
    volumes:
      - /mnt/media:/media
      - /home/pi/media-server/config/jellyfin:/config
    devices:
      - /dev/video0:/dev/video0
    restart: unless-stopped

Start Jellyfin:

docker compose up -d

4) Configure Jellyfin

Open the web UI:

http://<PI_IP>:8096

Set up:

Allow the server to complete its initial library scan.

Using Docker to Run the Jellyfin Media Server

5) Samba file share (optional but convenient)

Install:

sudo apt install samba -y

Edit configuration:

sudo nano /etc/samba/smb.conf

Add:

[Media]
   path = /mnt/media
   browseable = yes
   read only = no
   guest ok = no
   valid users = pi

Add Samba user:

sudo smbpasswd -a pi
sudo systemctl restart smbd

Connect from Windows/macOS:

\\<PI_IP>\Media

How to Set Up a Samba Server on the Raspberry Pi

Advanced Setup: Docker Compose (Multiple Services)

Example multi-service configuration:

version: "3.8"
services:
  jellyfin:
    image: jellyfin/jellyfin:latest
    container_name: jellyfin
    volumes:
      - /mnt/media:/media
      - /home/pi/media-server/config/jellyfin:/config
      - /dev/video0:/dev/video0
    ports:
      - 8096:8096
    restart: unless-stopped

  samba:
    image: dperson/samba
    container_name: samba
    volumes:
      - /mnt/media:/share
    command: "-s 'Media;/share;yes;no;pi;password' -u 'pi;password'"
    ports:
      - 139:139
      - 445:445
    restart: unless-stopped

Start everything:

docker compose up -d

Hardware Accelerated Transcoding on Raspberry Pi 5

The Pi 5 offers improved video capabilities via the V4L2 and VAAPI interfaces. Hardware acceleration is possible through /dev/video0, but performance is modest and varies depending on codecs and clients.

Practical guidelines:

Network Setup and Remote Access

LAN:

Remote access:

Best Security Practices

sudo apt update && sudo apt upgrade -y

Performance Tuning and Maintenance

Organizing your media for the best results

/mnt/media/
  Movies/
    Movie Title (Year)/Movie Title (Year).mkv
  TV/
    Show Name/Season 01/Show.Name.S01E01.mkv
  Music/
    Artist/Album/track01.flac
  Photos/

Consistent naming helps metadata scrapers produce accurate results.

Example maintenance commands

Reboot:

sudo reboot

Follow logs:

sudo journalctl -u jellyfin -f

Disk usage:

df -h

Update system:

sudo apt update && sudo apt full-upgrade -y

Update Docker images:

docker compose pull
docker compose up -d

Common Issues and Troubleshooting

Playback stutters

Slow performance during library scans

Incorrect metadata

Ideas to Expand Your Media Server

Advanced Example: Jellyfin + Traefik + Samba in Docker

version: "3.8"
services:
  traefik:
    image: traefik:v2.10
    command:
      - --providers.docker
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --certificatesresolvers.leresolver.acme.tlschallenge=true
      - --certificatesresolvers.leresolver.acme.email=you@example.com
      - --certificatesresolvers.leresolver.acme.storage=/letsencrypt/acme.json
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./letsencrypt:/letsencrypt
    restart: unless-stopped

  jellyfin:
    image: jellyfin/jellyfin:latest
    volumes:
      - /mnt/media:/media
      - ./jellyfin/config:/config
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.jellyfin.rule=Host(`jellyfin.yourdomain.com`)"
      - "traefik.http.routers.jellyfin.entrypoints=websecure"
      - "traefik.http.routers.jellyfin.tls.certresolver=leresolver"
    restart: unless-stopped

  samba:
    image: dperson/samba
    volumes:
      - /mnt/media:/share
    command: "-s 'Media;/share;yes;no;pi;YOUR_SMB_PASS'"
    ports:
      - "139:139"
      - "445:445"
    restart: unless-stopped

Final Checklist Before Starting

Summary and Recommendations

The Raspberry Pi 5 represents a significant upgrade for home media server builds. Its improved CPU, NVMe support, and higher I/O performance make it an excellent foundation for Jellyfin or Plex. For most users, a Raspberry Pi 5 + NVMe or SSD + Jellyfin setup strikes the perfect balance between simplicity, affordability, and capability.

Direct play remains the most reliable playback method, and Docker brings additional modularity for users who choose to expand their setup. Focusing on cooling, networking, and good file organization ensures a smooth and dependable long-term experience.

Raspberry Pi 5 Pinout, specifications, Pricing A Complete Guide

Raspberry Pi Compute Module 5 (CM5) Explained

Raspberry Pi LED Brightness Controller

Water Quality Monitoring System: TDS Sensor + ESP32/Arduino

Exit mobile version