---
title: "Plex Media Server"
description: "A guide on installing and configuring Plex Media Server."
---

# Plex Media Server

This guide was written for Synology DS1520+, but should work on any Linux-based system with Docker installed. Some steps may vary depending on your platform.

## Installation

### Prerequisites

- Docker ([installation guide](/guides/docker/))
- Compatible [Intel-based PC](https://www.intel.com/content/www/us/en/ark.html#@Processors) or [NAS](https://docs.google.com/spreadsheets/d/1MfYoJkiwSqCXg8cm5-Ac4oOLPRtCkgUxU0jdj3tmMPc) with [Quick Sync Video support](https://www.intel.com/content/www/us/en/support/articles/000029338/graphics.html) (optional, but required for hardware transcoding)
- [Plex Pass subscription](https://www.plex.tv/plans/) (optional, but required for hardware transcoding)

### Docker container

1. Pre-download the latest docker image:

   ```shellsession
    sudo docker pull ghcr.io/hotio/plex
   ```

   Normally we'd run `sudo docker compose pull && sudo docker compose up -d` after creating a `docker-compose.yaml` file, but we'll be time limited by the `PLEX_CLAIM_TOKEN` in a later step.

2. Create a new docker compose file:

   ```shellsession
   nano docker-compose.yaml
   ```

3. Copy and paste the following configuration into the file:

   ```yaml title="docker-compose.yaml"
   services:
     plex:
       container_name: plex
       image: ghcr.io/hotio/plex
       ports:
         - "32400:32400"
       environment:
         - PUID=1000
         - PGID=1000
         - UMASK=002
         - TZ=Etc/UTC
         - PLEX_CLAIM_TOKEN
         - PLEX_ADVERTISE_URL
         - PLEX_NO_AUTH_NETWORKS
         - PLEX_BETA_INSTALL=false
         - PLEX_PURGE_CODECS=false
       volumes:
         - /<host_folder_config>:/config
         - /<host_folder_transcode>:/transcode
         - /<host_folder_data>:/data
   ```

4. Change `PUID` and `PGID` to the user and group ID you want the container to run as:

   ```yaml title="docker-compose.yaml" "1000"
   environment:
     - PUID=1000
     - PGID=1000
   ```

   tip
   You can find these by running `id <username>` on your host system.

5. Change `TZ` to your local timezone. [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).

   ```yaml title="docker-compose.yaml" "Etc/UTC"
   environment:
     - TZ=Etc/UTC
   ```

6. Replace `<host_folder_config>`, `<host_folder_transcode>`, and `<host_folder_data>` with the paths to the directories on your host where you want to store Plex configuration files, transcoder temporary files, and media files respectively.

   ```yaml title="docker-compose.yaml" "/<host_folder_config>" "/<host_folder_transcode>" "/<host_folder_data>"
   volumes:
     - /<host_folder_config>:/config
     - /<host_folder_transcode>:/transcode
     - /<host_folder_data>:/data
   ```

7. Log into the [Plex website](https://www.plex.tv/claim/) and copy your claim token. This links your server to your Plex account automatically.

   ```yaml title="docker-compose.yaml" "<your_token_here>"
   environment:
     - PLEX_CLAIM_TOKEN=<your_token_here>
   ```

   The `PLEX_CLAIM_TOKEN` is only valid for **4 minutes** after being generated. Make sure to immediately start your container after copying the code.

8. Save the file and start the container:

   Press <kbd>Ctrl + O</kbd> to save the file and <kbd>Ctrl + X</kbd> to exit.

   Recreate and start the Plex container:

   ```shellsession
   sudo docker compose up -d
   ```

9. Test your setup by navigating to `http://<your_server_ip>:32400/web` in your web browser. You should see the Plex web interface where you can complete the setup and add your media libraries.

10. Forward the necessary ports on your router if you want to access Plex outside your local network. The default port is `32400`.

## Hardware-accelerated streaming

1. Edit your `docker-compose.yaml` file to include the `devices` section to enable hardware transcoding:

   ```diff title="docker-compose.yaml"
   services:
     plex:
       container_name: plex
       image: ghcr.io/hotio/plex
       ports:
         - '32400:32400'
       environment:
         - PUID=1000
         - PGID=1000
         - UMASK=002
         - TZ=Etc/UTC
         - PLEX_CLAIM_TOKEN
         - PLEX_ADVERTISE_URL
         - PLEX_NO_AUTH_NETWORKS
         - PLEX_BETA_INSTALL=false
         - PLEX_PURGE_CODECS=false
       volumes:
         - /<host_folder_config>:/config
         - /<host_folder_transcode>:/transcode
         - /<host_folder_data>:/data
   +    devices:
   +      - /dev/dri:/dev/dri
   ```

2. Restart your Plex container to apply the changes:

   ```shellsession
   sudo docker compose pull && sudo docker compose up -d
   ```

3. Enable hardware acceleration

   To use Hardware-Accelerated Streaming in Plex Media Server, you need to enable it using the Plex Web App.
   1. Open the Plex Web app.
   2. Navigate to `Settings > Server > Transcoder` to access the server settings.
   3. Toggle `Show Advanced` in the upper-right corner to expose advanced settings.
   4. Enable `Enable HDR tone mapping`, `Use hardware acceleration when available` and `Use hardware-accelerated video encoding`.
   5. Click `Save Changes` at the bottom.

4. To check to see if hardware acceleration is being used during a video playback:
   1. Play a video on any Plex app.
   2. In the quality settings of the Plex player app, reduce the video quality to force Plex Media Server to convert the video (for example, select `Convert to 480p`).
   3. Open the [Plex Web App](https://app.plex.tv/desktop/#!/).
   4. In the Plex Web App, click on the `Activity` icon in the upper-right corner.
   5. Visit the `Dashboard` for the playing video
   6. Use the toggle at the top right of the Now Playing area to expose additional details of the playback
   7. When hardware acceleration is being used, you should see `(hw)` next to the `Video` format.

## Troubleshooting

### Buffering issues

If you encounter buffering during playback, make sure [hardware acceleration](/guides/plex-media-server/#hardware-accelerated-streaming) is enabled and try increasing `Transcoder default throttle buffer` under `Settings > Server > Transcoder` to `600` seconds.

### Playback on local network shows as remote

If playback on your local network is showing as remote, you may need to change the network mode of the container to `host` to allow Plex to correctly identify local network traffic.

Remote streams are limited to a lower bitrate compared to local streams, which can affect playback quality.

Edit your `docker-compose.yaml` file to include `network_mode: host`:

```diff title="docker-compose.yaml"
services:
  plex:
    container_name: plex
    image: ghcr.io/hotio/plex
+    network_mode: host
-    ports:
-      - '32400:32400'
    environment:
      - PUID=1000
      - PGID=1000
      - UMASK=002
      - TZ=Etc/UTC
      - PLEX_CLAIM_TOKEN
      - PLEX_ADVERTISE_URL
      - PLEX_NO_AUTH_NETWORKS
      - PLEX_BETA_INSTALL=false
      - PLEX_PURGE_CODECS=false
    volumes:
      - /<host_folder_config>:/config
      - /<host_folder_transcode>:/transcode
      - /<host_folder_data>:/data
```

### Plex support

For more detailed troubleshooting, please refer to the official [Plex Support website](https://support.plex.tv/).

## References

The following sources were used while writing this guide:

- [hotio/plex - hotio.dev](https://hotio.dev/containers/plex/#__tabbed_1_2)
- [Intel Quick Sync Hardware Transcoding Support](https://github.com/plexinc/pms-docker#intel-quick-sync-hardware-transcoding-support)
- [Using Hardware-Accelerated Streaming | Plex Support](https://support.plex.tv/articles/115002178853-using-hardware-accelerated-streaming/)
- [NAS Compatibility List | Plex Support](https://support.plex.tv/articles/201373803-nas-compatibility-list/)
