TutorialsAugust 4, 20265 min read

How to Self-Host Plex on a Linux VPS

Turn a Linux VPS into your personal Plex server. Install with Docker, claim it to your account, and stream your library to every device you own.

NBy Nxeon

Plex turns a folder of movies and shows into a polished, Netflix-style library you can stream anywhere. This guide installs Plex Media Server on a Linux VPS using Docker, claims it to your account, and gets your first library playing. If you want a no-account, fully free alternative, compare with Jellyfin before you commit.

Before you start

  • A Linux VPS (Ubuntu or Debian) with Docker installed — see how to run Docker on a VPS.
  • A free Plex account from plex.tv.
  • Media files on the server, e.g. under /srv/media/movies and /srv/media/tv.

Get a claim token

Plex uses a short-lived token to link a new server to your account. While logged in to plex.tv, visit plex.tv/claim and copy the token (it starts with claim- and expires in four minutes, so grab it just before you start the container).

Run Plex with Docker Compose

mkdir -p ~/plex && cd ~/plex
services:
  plex:
    image: plexinc/pms-docker:latest
    container_name: plex
    restart: unless-stopped
    network_mode: host
    environment:
      - PLEX_CLAIM=claim-xxxxxxxxxxxxxxxxxxxx
      - PLEX_UID=1000
      - PLEX_GID=1000
      - TZ=Europe/London
    volumes:
      - ./config:/config
      - ./transcode:/transcode
      - /srv/media:/data:ro

Plex works best with network_mode: host because it advertises itself on the local network for discovery. Start it:

docker compose up -d

Claim and configure

Open http://your-server-ip:32400/web. Because you supplied a claim token, the server should already be linked to your account. Add libraries pointing at /data/movies and /data/tv, and let Plex scan and fetch metadata.

The Nxeon game-server control panel — live console, player slots, and TPS
The Nxeon game-server control panel — live console, player slots, and TPS

Remote access and security

Plex handles remote streaming through its own relay, but for best performance you want direct access. In Settings → Remote Access, enable it and confirm the port (32400) is reachable. Open just that port and SSH:

sudo ufw allow OpenSSH
sudo ufw allow 32400/tcp
sudo ufw enable

Because Plex terminates its own TLS through plex.direct, you generally don't need a separate reverse proxy — but if you want a clean custom domain for the web UI, you can still put Nginx in front. For anything else you self-host alongside it, keep the firewall tight as covered in securing your first Linux VPS.

Managing transcoding load

The same CPU caution from other media servers applies. On a VPS:

  • Set a remote-stream quality cap per user so a single 4K transcode doesn't peg the CPU.
  • Store the transcode directory on fast NVMe (it already is if it's on the VPS disk).
  • Pre-encode big files to widely supported H.264 so clients direct-play.

Keeping Plex updated

cd ~/plex
docker compose pull && docker compose up -d

The image ships new Plex releases regularly; pull weekly to stay current.

Organising your media for clean matching

Plex's polished library depends on tidy file organisation, just like any media server. Name things predictably so Plex's agents fetch the right posters and metadata:

  • Movies: Movies/Title (Year)/Title (Year).mkv.
  • TV: TV/Show Name/Season 01/Show Name - S01E01.mkv.

Keep movies and TV in separate top-level libraries pointing at /data/movies and /data/tv, and let Plex scan. If an item matches incorrectly, use *Fix Match* on it to search manually — a couple of minutes of cleanup pays off across every client and device.

Sharing your library

One of Plex's nicest features is sharing. From *Settings → Users & Sharing* you can invite friends or family by email and grant access to specific libraries. They log in with their own Plex account and see your content in their own app, with their own watch history and recommendations. Combined with per-user quality limits, this makes Plex a genuinely social media server.

Just remember every remote stream uses your VPS bandwidth and possibly CPU, so cap qualities sensibly and keep an eye on concurrent usage — a handful of simultaneous transcodes will find the ceiling of a small plan quickly.

Getting your media onto the server

Plex serves files that live on the VPS or attached storage, so you need to upload your library first. Use rsync to copy it up efficiently — it resumes and only transfers changes:

rsync -avP ~/Movies/ user@your-server-ip:/srv/media/movies/

Keep the collection on a dedicated block storage volume mounted at /srv/media so you can expand capacity later without touching the container. Once files are in place, Plex scans, matches and downloads rich metadata — posters, summaries, cast and even theme music — turning a plain folder into a browsable library.

Bandwidth and concurrent streams

Plan for the traffic your viewers generate. A rough guide per stream:

  • 1080p direct play: around 8–12 Mbps.
  • 4K: 25 Mbps or more.
  • Transcoded streams also cost CPU, which a GPU-less VPS handles in software.

Multiply by the number of people watching at once and make sure your VPS bandwidth allowance and CPU comfortably cover the peak. Setting a per-user remote-quality cap is the simplest way to keep a busy evening from saturating the server.

FAQ

Can I run Plex on a VPS legally?

Yes — Plex itself is legitimate software for streaming media you own. Only stream content you have the rights to.

Do I need Plex Pass?

No. The core server and streaming are free. Plex Pass adds hardware transcoding, mobile downloads and a few extras. On a VPS without a GPU, hardware transcoding may not apply anyway.

Why use host networking for Plex?

Plex relies on network discovery and advertises multiple ports. Host networking avoids the port-mapping headaches that bridge mode causes with Plex specifically.

Plex or Jellyfin on a VPS?

Plex has the more refined apps and easier remote access; Jellyfin is free forever with no account. See the Jellyfin media server guide to compare.

Give your media library a permanent home on a fast NVMe VPS with full root access. Check plans and bandwidth on the pricing page.

#plex#media-server#docker#self-hosting#vps#seobatch

Deploy your first server in under a minute

Creating an account is free and takes no card details. You pay when you deploy — choose a billing term and pay from your wallet or by card at checkout.