# Plex Server Setup This repository contains scripts and configuration for setting up a Plex Media Server. I run this on a Raspberry Pi 4B running Debian. ## Assumptions - Server running Debian (e.g. apt-based) - External storage device with UUID `2c882f17-50e7-4099-a305-693f4aa0113b` - Comment out `ensure_fstab_entry` if you're not using a separate external hard drive for your media or change the UUID as needed. If you comment it out, we'll want to adjust the Plex data directory from `/mnt/media/Plex` to wherever your data will be. - Plex account and claim token ## Installation 1. Copy the files over to your server: ```sh scp compose.yaml @:/home//compose.yaml scp setup-plex.sh @:/home//setup-plex.sh ``` 2. SSH into your server: ```sh ssh @ ``` 3. Set the plex claim token (get a claim token at https://www.plex.tv/claim/): ```sh sed 's|PLEX_CLAIM=|PLEX_CLAIM=your-actual-token-here|' compose.yaml > compose.yaml.tmp \ && mv compose.yaml.tmp compose.yaml ``` 4. Additionally, the timezone is hard-coded to 'America/New_York'. If that's not your timezone, adjust it in the `compose.yaml` file: ```sh sed 's|TZ=America/New_York|TZ=your-timezone-here|' compose.yaml > compose.yaml.tmp \ && mv compose.yaml.tmp compose.yaml ``` 5. Run the installation script to set up an fstab entry for a external hard drive and install docker: ```sh chmod +x setup-plex.sh sudo ./setup-plex.sh ``` 6. After the fstab entry is added, ensure the drive is mounted for the external hard drive: ```sh sudo mount -a ``` 7. Now, finally, we can start plex: ```bash docker compose up --detach ``` ## Configuration ### Volume Mappings - `/mnt/media/Plex` - Media files on an external drive - `/opt/plex-config` - Plex configuration and metadata on the server drive - `/opt/plex-transcode` - Temporary transcoding files on the server drive ### Ports Plex uses multiple ports for different features. All necessary ports are exposed in the compose file.