Plex organises your movies, TV shows, music and photos, fetches artwork and metadata, and streams to apps on almost every device: smart TVs, phones, consoles and browsers. Running Plex on a VPS or dedicated server gives you a static IP and strong upload bandwidth for streaming anywhere, without depending on your home connection.
Deciding between media servers? See Jellyfin vs Plex vs Emby.
Before you start: the VPS reality check
- Transcoding (converting video on the fly) is CPU-heavy, and most VPSes have no GPU. One 1080p transcode needs roughly 2 strong vCPUs. Aim for direct play: files in formats your devices play natively (H.264/H.265 video, AAC audio, MP4/MKV).
- Storage: media libraries grow fast. A storage VPS or a dedicated server with big disks is often better than a standard VPS. See storage VPS.
- Bandwidth: 1080p streams use roughly 5–10 Mbit/s. Check your plan’s monthly transfer. See vnStat.
Only stream media you have the rights to.
Option 1: Docker (recommended)
Get a claim token from https://www.plex.tv/claim (valid for 4 minutes). It links the server to your Plex account.
# /opt/plex/compose.yaml
services:
plex:
image: plexinc/pms-docker:latest
restart: unless-stopped
network_mode: host # simplest for discovery and remote access
environment:
TZ: Etc/UTC
PLEX_CLAIM: claim-xxxxxxxxxxxx
PLEX_UID: 1000
PLEX_GID: 1000
volumes:
- /opt/plex/config:/config
- /opt/plex/transcode:/transcode
- /srv/media:/data
cd /opt/plex && docker compose up -d
Organise media on the host:
/srv/media/Movies/Movie Name (2021)/Movie Name (2021).mkv
/srv/media/TV Shows/Show Name/Season 01/Show Name - s01e01.mkv
Following Plex’s naming conventions gives accurate metadata matching.
Option 2: the official package
Add Plex’s repository (see Plex’s Linux install instructions), then:
sudo apt install plexmediaserver
sudo systemctl enable --now plexmediaserver
Give the plex user read access to your media folders. See Linux file permissions.
Initial setup on a remote server
The setup wizard only allows unclaimed servers to be configured from the local network. On a VPS, either use the claim token (Docker), or open an SSH tunnel and run the wizard through it:
ssh -L 8888:127.0.0.1:32400 user@your-vps
# then open http://localhost:8888/web in your browser
See SSH tunnels. Add libraries (Movies → /data/Movies, and so on), and let Plex scan them.
Remote access
Plex listens on TCP 32400. In Settings → Remote Access, enable it, and open the port:
sudo ufw allow 32400/tcp
Clients then connect via plex.tv discovery. Alternatively, put Plex behind a reverse proxy with your own domain and certificate, and set Custom server access URLs (https://plex.example.com:443) in Settings → Network. Plex also provides its own secure *.plex.direct certificates for direct connections.
Transcoding settings
- Settings → Transcoder: set quality to prefer higher speed on a CPU-only server. Point the temporary transcoder directory to fast local storage (
/transcode). - In client apps, set remote quality to “Original”/“Maximum” where bandwidth allows, so the server doesn’t transcode.
- Hardware transcoding (Intel Quick Sync, NVIDIA) requires Plex Pass and a GPU on the host. It’s typically available on dedicated servers or home hardware, not on standard VPSes.
- Pre-convert problematic files (for example with HandBrake or ffmpeg) to direct-play formats.
Keep it healthy
- Updates: Docker,
docker compose pull && docker compose up -d. Package installs update via apt. See updating self-hosted apps. - Back up
/opt/plex/config(the library database, metadata and settings). Media files should be backed up separately if they’re not replaceable. See backup strategy. - Disk space: metadata and thumbnails can grow to tens of GB on large libraries.
Security
- Use a strong Plex account password with 2FA (the server is tied to your account).
- Share libraries with specific Plex users only.
- Keep the server and Plex updated. Media servers exposed to the internet are attack targets.
- Don’t expose other services on the same host unnecessarily. See Linux server hardening.
Quick reference
| Task | Command / setting |
|---|---|
| Claim token | plex.tv/claim |
| Docker start | docker compose up -d |
| Port | TCP 32400 |
| First setup on VPS | SSH tunnel to 127.0.0.1:32400/web |
| Avoid transcoding | Direct-play formats + “Original” quality |
| Config to back up | /opt/plex/config |
Related: Jellyfin media server and Emby server.