Plex Server on Raspberry Pi

Installing Docker, Docker-Compose, Samba, Homebridge and Plex.

TechDraft

Install Docker and Docker-Compose

  1. SSH to Raspberry Pi

ssh pi@raspberry.local

  1. Configure localization

sudo raspi-config

  1. Update and upgrade the OS

sudo apt-get update && sudo apt-get upgrade -y

  1. Download and install Docker

curl -fsSL https://get.docker.com | sh

  1. Add user to the docker group

sudo usermod -aG docker ${USER}

  1. Check if the user was added on the docker group

groups ${USER}

  1. Start Docker at startup

sudo systemctl enable docker

  1. Reboot

sudo reboot

  1. Install Docker-Compose
sudo apt-get install libffi-dev libssl-dev
sudo apt install python3-dev
sudo apt-get install -y python3 python3-pip

sudo pip3 install docker-compose

  1. Check if Docker works

docker run hello-world

Mount disk

Mounting manually

  1. Connect the drive

  2. Create the directory where to mount the disk on /mnt/. For example AlanDoozTV

sudo mkdir /mnt/AlanDoozTV

  1. Find the name of the external disk, for example /dev/sda2

sudo fdisk -l

  1. Mount drive to folder previously created

sudo mount /dev/sda2 /mnt/AlanDoozTV

  1. Verify it was successfully mounted by listing the content of the drive

ls /mnt/AlanDoozTV

  1. To unmount the storage device

sudo umount /mnt/AlanDoozTV

Mounting automatically

  1. Find the UUID of the disk partition

sudo blkid

  1. Modify the fstab file to define where storage devices will be automatically mounted when the Raspberry Pi boots

sudo nano /etc/fstab

  1. Add the following line, replacing the UUID value with the one from your drive (example 42B3-CF79), mount location (example /mnt/AlanDoozTV) and file system type (example exfat)

UUID=42B3-CF79 /mnt/AlanDoozTV exfat defaults,auto,users,rw,nofail 0 0

  1. Mount the first time

sudo mount -a

Installing Homebridge, Samba and Plex with Docker-Compose

First steps

  1. Creating neccesary folder structure

mkdir -p /homebridge /plex/config

  1. Creating a docker-compose.yml file with the following content
version: "2"

services:

  homebridge:
    image: oznu/homebridge:latest
    container_name: homebridge
    restart: always
    network_mode: host
    environment:
      - HOMEBRIDGE_CONFIG_UI_PORT=8581
    volumes:
      - ./homebridge:/homebridge
    logging:
      driver: json-file
      options:
        max-size: "10mb"
        max-file: "1"

  samba:
    image: dperson/samba:latest
    container_name: samba
    restart: always
    read_only: false
    command: '-u "pi;password" -s "AlanDoozTV;/AlanDoozTV;yes;no;" -p'
    stdin_open: true
    tty: true
    ports:
      - 139:139
      - 445:445
    volumes:
      - /usr/share/zoneinfo/America/Argentina/Buenos_Aires:/etc/localtime
      - /mnt/AlanDoozTV:/AlanDoozTV
    environment:
      - USERID=0
      - GROUPID=0

  plex:
    image: lscr.io/linuxserver/plex:latest
    container_name: plex
    network_mode: host
    environment:
      - PUID=1000
      - PGID=1000
      - VERSION=dockerl
    volumes:
      - ./plex/config:/config
      - /mnt/AlanDoozTV/movies:/movies
      - /mnt/AlanDoozTV/tv:/tv
    restart: unless-stopped

  tautulli:
    container_name: tautulli
    image: lscr.io/linuxserver/tautulli:latest
    restart: unless-stopped
    ports:
      - 8181:8181
    volumes:
      - ./tautulli/config:/config
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Buenos_Aires

  radarr:
    image: lscr.io/linuxserver/radarr:latest
    container_name: radarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Buenos_Aires
    volumes:
      - ./radarr/config:/config
      - /mnt/AlanDoozTV/downloads:/downloads
      - /mnt/AlanDoozTV/movies:/movies
    ports:
      - 7878:7878
    restart: unless-stopped

  sonarr:
    image: lscr.io/linuxserver/sonarr:latest
    container_name: sonarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Buenos_Aires
    volumes:
      - ./sonarr/config:/config
      - /mnt/AlanDoozTV/downloads:/downloads
      - /mnt/AlanDoozTV/tv:/tv
    ports:
      - 8989:8989
    restart: unless-stopped

  prowlarr:
    image: lscr.io/linuxserver/prowlarr:develop
    container_name: prowlarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Buenos_Aires
    volumes:
      - ./prowlarr/config:/config
    ports:
      - 9696:9696
    restart: unless-stopped

  transmission:
    image: lscr.io/linuxserver/transmission:latest
    container_name: transmission
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Buenos_Aires
      - TRANSMISSION_WEB_HOME=/transmission-web-control/
    volumes:
      - ./transmission/config:/config
      - /mnt/AlanDoozTV/downloads:/downloads
      - /mnt/AlanDoozTV/torrents:/torrents
    ports:
      - 9091:9091
      - 51413:51413
      - 51413:51413/udp
    restart: unless-stopped

  flaresolverr:
    image: ghcr.io/flaresolverr/flaresolverr:latest
    container_name: flaresolverr
    environment:
      - LOG_LEVEL=${LOG_LEVEL:-info}
      - LOG_HTML=${LOG_HTML:-false}
      - CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none}
      - TZ=America/Buenos_Aires
    ports:
      - 8191:8191
    restart: unless-stopped
  1. Initializing the containers

docker-compose up -d

How to connect to

Homebridge

Go to http://raspberrypi.local:8581

Samba

On MacOs you can go to Go on Finder, Connect to Server ( + K) and with the user and password of the docker-compose.yml connect to the following url:

smb://raspberrypi.local

Plex

Go to http://raspberrypi.local:32400/web

Tautulli

Go to http://raspberrypi.local:8181

Radarr

Go to http://raspberrypi.local:7878

Sonarr

Go to http://raspberrypi.local:8989

Prowlarr

Go to http://raspberrypi.local:9696

Transmission

Go to http://raspberrypi.local:9091

FlareSolverr

http://raspberrypi.local:8191

Naming and Organizing Your Files


Alan Becker Capuyá

From ONG's to enrepeneurism, in love with tech and innovation, I'm looking to be part of the social revolution seeking a better world.