Plex on Raspberry Pi

Plex is a media server and streaming platform that lets you organize your personal media library and stream it to virtually any device, while also offering free movies, TV shows, live TV, and podcasts.

๐Ÿ” Key Features

NOTE: Unlike Jellyfin, Plex is only free if streaming on your local network. There is a cost if you want to stream remotely.

Plex vs Jellyfin

Plex is wonderful. You can have one media directory and dump all your content there (e.x. Movies, TV Shows) and Plex will scan that directory and sort out of it's a Movie or TV Show. Jellyfin, on the otherhand, requires that you have a seperate directory for movies and one for TV shows. Each TV show has to have subdirectories, one per season. It's not nearly as slick as Plex. Since I run Plex (for inside my network use) and Jellyfin (for remote use) and I use the same media directories for both, I had to redo my Plex config to use a Movies directory and a TV Shows directory. That setup is in this guide. Could I use Plex for local and remote viewing? Sure. I'm working on it. I've got tailscale setup on my mac, iPhone, and Pi. I can connect to Plex on my laptop using Tailscale and my iPhone as a hotspot and everything works great but when I try to use the Plex app in my iPhone (with WiFi off), I hit the paywall. I'm not sure why yet. Jellyfin has no paywall which is why I added that to my enviroment.

๐Ÿš€ Docker Installation Steps

  1. Update your system
    sudo apt update && sudo apt upgrade -y
  2. Install Docker
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
  3. Install Docker Compose
    sudo apt install docker-compose-plugin
  4. Add your user to the Docker group
    sudo usermod -aG docker $USER
  5. Enable Docker at boot
    sudo systemctl enable docker
  6. Reboot
    sudo reboot
  7. Test Docker
    docker run hello-world

๐Ÿ“ Setup Plex

mkdir ~/docker
mkdir ~/docker/plex
mkdir ~/docker/plex/config

๐Ÿงพ Docker Compose File

In ~/docker/plex create docker-compose.yml

services:
  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=docker
      - PLEX_CLAIM=claim-VFDzv3bHizaXfnhJk8h2
      - PLEX_LOG_LEVEL=DEBUG
    volumes:
      - /mnt/Movies:/Movies      #Where you'll access your Movies
      - /mnt/TV Shows:/TV Shows  #Where you'll access your TV Shows
      - ~/docker/plex/config:/config
    restart: unless-stopped

NOTE: Follow this guide to setup your media folder: Plex Media Structure

Like I mentioned before, you could have just one Media directory and dump everything there and let Plex sort it out. It's about 99% accurate. If it gets something wrong, it's a pretty easy fix.

โ–ถ๏ธ Start Plex

From within ~/docker/plex run:

docker compose up -d

๐Ÿ“œ View Logs

docker logs plex

๐ŸŒ Access Web Interface

Open your browser and go to http://<your-pi>:32400

Bypassing the Plex paywall

Plex used to be free. You could watch your content locally or remotely. Recently, they added a paywall for remote viewing. Here's a way to bypass the paywall (for experimental purposes only). I'll walk through doing this so you can watch remotely from your phone. Same steps for pretty much any device.

  1. Install Tailscale on your Pi and phone.
  2. On your Pi, run these commands to enable IP forwarding:
    echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
    echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.d/99-tailscale.conf
    sudo sysctl -p /etc/sysctl.d/99-tailscale.conf
    if those commands fail, run these:
    echo 'net.ipv4.ip_forward = 1' | sudo tee -a /etc/sysctl.conf
    echo 'net.ipv6.conf.all.forwarding = 1' | sudo tee -a /etc/sysctl.conf
    sudo sysctl -p /etc/sysctl.conf
  3. Now run this to advertise the routes and exit node (Use your subnet for 192.168.0.0/24):

    docker exec -it tailscale tailscale up --advertise-routes=192.168.0.0/24 --advertise-exit-node

  4. Log in to Tailscale's website
  5. Browse to Machines. You should see your Pi and iPhone listed.
  6. Your Pi should now have subnets and exit node badges. Click the three dots to the right of your Pi and select Edit route settings.
  7. Check Subnet routes and Use as exit nodei and click on Save
  8. Now browse to your Plex server running on your Pi (ex. http://pi:32400). Click on the wrench in the upper right corner. On the left hand side, select Network.
  9. Set Secure Connection to Preferred. Make sure Enable Relay is unchecked.
  10. This step messed me up and it took me days to figure this out. There are guides out there that say you have to fill in Custom server access URLs. Do not do that. Leave it blank.
  11. Scroll to the bottom and click on Save Changes

Test the bypass

Here's how to test if you have it set up correctly. I assume that you already have Plex installed and working on your phone.

  1. Turn off wi-fi on your phone. This will put you on cellular only and therefore you'll be off your network.
  2. Open Plex on your phone
  3. Click on Libraries. You should see your media there.
  4. Select any TV Show or Movie and play it. You should not see the paywall pop up and your media should play.

If you find my content useful, please consider supporting this page:

โ˜• Buy Me a Coffee