LinuxinfrastructureTested on real hardware

Install Plex Media Server on Debian/Ubuntu

Add Plex's official APT repository, install Plex Media Server, and claim a headless server to your account from the command line.

Distrosubuntu, debian
Shellbash
Updated
Script
bash
#!/usr/bin/env bash
# Install Plex Media Server from the official APT repo on Debian/Ubuntu.
set -euo pipefail

# 1. Add Plex's signing key and repository
curl -fsSL https://downloads.plex.tv/plex-keys/PlexSign.key \
  | sudo gpg --dearmor -o /usr/share/keyrings/plex.gpg

echo "deb [signed-by=/usr/share/keyrings/plex.gpg] https://downloads.plex.tv/repo/deb public main" \
  | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

# 2. Install
sudo apt-get update
sudo apt-get install -y plexmediaserver

# 3. Confirm it is running (listens on :32400)
sudo systemctl enable --now plexmediaserver
sudo systemctl status plexmediaserver --no-pager

echo
echo "Setup UI:  http://<this-server-ip>:32400/web"
echo "If headless, claim it with a token from https://plex.tv/claim :"
echo '  curl -X POST "http://127.0.0.1:32400/myplex/claim?token=claim-YOUR_TOKEN"'

What this does

Installs Plex Media Server from Plex’s official APT repository so it stays updated with apt upgrade — the right approach on a Debian or Ubuntu box, or inside a container. After this, Plex listens on port 32400 and you finish setup in the browser. Full walkthrough (libraries, bind-mounts, remote access) is in the Install Plex on a NAS or Proxmox LXC guide.

Why this approach

Installing Plex from its official APT repository rather than downloading a .deb manually is the right long-term approach because it means updates arrive with apt upgrade like any other package. Manual installs need you to check the Plex website, download a new package, and run dpkg -i every time there’s a security fix or new feature. The official repository turns that into a fully automated process.

Running Plex in a Proxmox LXC container (the typical homelab setup) is recommended over a full VM for the same reason you’d use any container for a single service: lower overhead, faster startup, and a clean separation of concerns. The LXC gets its own IP, its own resource limits, and can be snapshotted independently. When the day comes to move Plex to different hardware, you’re moving one container, not an entire operating system.

The headless claim step after install — connecting to the server through an SSH tunnel — is necessary because Plex requires an authenticated request from localhost to complete initial setup. Without the tunnel, a remote browser can’t reach localhost:32400 on the server. The SSH port-forward (-L 8888:localhost:32400) makes the server’s Plex port appear as a local port on your laptop for the duration of the tunnel session.

Prerequisites

  • Debian 11/12 or Ubuntu 20.04+ (bare metal, VM, or LXC)
  • curl and sudo
  • Read access to wherever your media lives (bind-mount it in for containers)

Claim a headless server

If you can’t open the web UI from the same network (a server on an isolated VLAN), claim it with a token instead. Get one from plex.tv/claim — it’s valid for four minutes — then:

bash

curl -X POST "http://127.0.0.1:32400/myplex/claim?token=claim-YOUR_TOKEN_HERE"

A claimed server appears automatically in every Plex app you sign into.

Notes

  • Updates: sudo apt-get update && sudo apt-get install --only-upgrade plexmediaserver. The official repo is the whole point — no manual package hunting.
  • On a NAS instead of Debian? Use the vendor’s app store package, or manual-install the .spk/.apk/.qpkg from plex.tv/media-server-downloads — the APT repo is Debian/Ubuntu only.
  • Permissions: Plex runs as the plex user. If a library shows empty, the media files are likely unreadable by that user — check ownership with ls -ln.
  • Hardware transcoding is a Plex Pass feature; see the Direct Play & transcoding guide before relying on it.