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
Shell
bashUpdated
Script
#!/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.
Prerequisites
- Debian 11/12 or Ubuntu 20.04+ (bare metal, VM, or LXC)
curlandsudo- 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:
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/.qpkgfrom plex.tv/media-server-downloads — the APT repo is Debian/Ubuntu only. - Permissions: Plex runs as the
plexuser. If a library shows empty, the media files are likely unreadable by that user — check ownership withls -ln. - Hardware transcoding is a Plex Pass feature; see the Direct Play & transcoding guide before relying on it.