Tom

Tom

Installing Plex on Docker

1. Preparation#

  1. The server needs to have Docker installed.
  2. Docker-compose should be able to run.
  3. Plex account.

2. Installation Tutorial#

2.1 Creating relevant directories#

mkdir -p 'custom data directory'/plex/config # Plex configuration file directory
mkdir -p 'custom data directory'/plex/transcode # Plex transcoding file directory
mkdir -p 'custom data directory'/plex/data # Plex data file directory
For example:
mkdir -p /usr/plex/config

2.2 Obtaining Plex token#

You can obtain a claim token by visiting https://www.plex.tv/claim to log your server into your Plex account, and copy and paste the token characters into the corresponding position in the docker-compose file below. Necessary operation.

2.3 Creating docker-compose file and running#

vim /usr/plex/docker-compose.yml
---

version: '3'

services:
 plex:
   image: plexinc/pms-docker:latest                  # Install the latest version
   hostname: PlexServer                              # Custom host name
   restart: always                                   # Set restart policy
   volumes:
     - "'custom data directory'/plex/config:/config"          # Plex configuration file directory
     - "'custom data directory'/plex/transcode:/transcode"    # Plex transcoding file directory
     - "'custom data directory'/plex/data:/data"              # Plex data file directory
     - "'video file save directory':/video"
   ports:
     - 32400:32400/tcp                               # Plex web access port, for example, if you want to change it to access through port 8080, modify it to 8080:32400
     - 3005:3005/tcp                                 # Plex Companion
     - 8324:8324/tcp                                 # Controlling Plex for Roku via Plex Companion
     - 32469:32469/tcp                               # Access to the Plex DLNA Server
     - 32468:1900/udp                                # Access to the Plex DLNA Server
     - 32410:32410/udp                               # Current GDM network discovery
     - 32412:32412/udp                               # Current GDM network discovery
     - 32413:32413/udp                               # Current GDM network discovery
     - 32414:32414/udp                               # Current GDM network discovery
   # devices:                                        # Share hardware devices with FFmpeg (optional)
     #  - "/dev/dri:/dev/dri"                        # Intel QSV
     #  - "/dev/nvidia0:/dev/nvidia0"                # Nvidia CUDA
     #  - "/dev/nvidiactl:/dev/nvidiactl"
     #  - "/dev/nvidia-modeset:/dev/nvidia-modeset"
     #  - "/dev/nvidia-nvswitchctl:/dev/nvidia-nvswitchctl"
     #  - "/dev/nvidia-uvm:/dev/nvidia-uvm"
     #  - "/dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools"
     #  - "/dev/video11:/dev/video11"                # Raspberry V4L2
   environment:
     TZ: Asia/Shanghai                               # Container internal time zone
     PLEX_UID: 0                                     # User ID created inside the container (do not change if you don't understand)
     PLEX_GID: 0                                     # User group ID created inside the container (do not change if you don't understand)
     PLEX_CLAIM: claimToken                          # Claim token for the real server, you can obtain a claim token by visiting https://www.plex.tv/claim to log your server into your Plex account
     ADVERTISE_IP: hostIPAddress:32400/              # Fill in the fixed IP or domain name for external access, you can delete this line if not available

2.4 Opening corresponding ports, etc.#

Whether it is the local firewall or the firewall in the cloud platform control panel such as Alibaba Cloud, the corresponding ports should be opened. Among them, 32400 must be opened, and my colleague also opened 3005. Other ports are not opened because it is a VPS and does not require DLNA and GDM.

2.5 Access and check the result#

Check the result by accessing the Plex management page through the domain name.

http://'domain':32400

3.1 Remote access is "indirect/relay"#

Because Docker is used for installation, the IP displayed by the network card allocated inside the container is an internal IP, so in the management interface's "corresponding server" - remote access, the internal IP is a 172-starting internal network, and the public external IP port may be 0.

Click on "Manually specify port" below, fill in the default: 32400, click apply, and after running, the problem will be solved. It will display "Full access outside your network".

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.