Step-by-Step Guide: Installing Plex Media Server on Ubuntu
Plex offers a robust self-hosted media management platform. On Ubuntu, it’s straightforward to deploy—but a few details catch even experienced sysadmins off guard.
Why Plex + Ubuntu?
Direct control, regular security updates, and lightweight resource usage. Ubuntu LTS releases (20.04/22.04) pair well for multi-year uptime and minimal surprises after upgrades. Plex’s metadata engine brings order to scattered media. For heterogeneous households—Apple TV, Android, Windows, you name it—this is markedly simpler than NFS shares and Kodi.
Requirements and Initial Preparation
Stale packages cause subtle breakages. Always bring your base system up to date first:
sudo apt update && sudo apt upgrade -y
Expectations: At least 2GB RAM, 10GB disk (media storage not included), and a CPU supporting SSE4.2 or later (for transcoding efficiency).
Repository Setup (Official Source Only)
Do not fetch .deb
packages from mirrors—use the vendor repo for security patches. Ubuntu Server or Desktop work identically.
Install prerequisites:
sudo apt install curl apt-transport-https -y
Import the Plex GPG key:
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
Known issue: Older Ubuntu releases throw a deprecation warning for apt-key
.
Alternative: Use /usr/share/keyrings/plex-archive-keyring.gpg
with signed-by, if on 22.04+.
Add the repo (current for 20.04+):
echo "deb https://downloads.plex.tv/repo/deb public main" | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
sudo apt update
Installation and Service Checks
Plex is distributed as a systemd service, running under the plex
user.
sudo apt install plexmediaserver -y
Confirm service status:
systemctl status plexmediaserver
Active state required:
● plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: active (running) since ...
If inactive (dead)
or restart loops occur, analyze systemd logs:
journalctl -u plexmediaserver
Common culprit: missing or inaccessible media directories.
Firewall & Network Access
With UFW:
sudo ufw allow 32400/tcp
sudo ufw reload
Default port: 32400
. For streaming outside your LAN, NAT must allow 32400/TCP (UPnP can automate this, but verify with your router).
Gotcha: Some ISPs block inbound 32400; change the port via Plex settings if necessary._
Initial Web Configuration
Browse to the server locally:
http://<ubuntu-ip>:32400/web
To find your IP:
hostname -I
Sign in with a Plex account. Expect a one-time signup prompt.
Folder layout example:
/srv/media/Movies/
/srv/media/TV/
/srv/media/Music/
Configure these as libraries in the web UI.
Note: Non-standard locations (external drives, network shares) require correct user permissions, below.
Permissions and User Access
By default, Plex runs as user plex
. Grant it access to your media storage:
sudo chown -R plex:plex /srv/media/
sudo chmod -R 755 /srv/media/
Alternative: Add plex
to your primary group if sharing storage:
sudo usermod -aG <yourgroup> plex
Adjust ACLs for finer-grained sharing, e.g.:
sudo setfacl -m u:plex:rX /mnt/my_nas_share
Critically, permission issues cause missing libraries, and Plex logs won’t always make this obvious.
Advanced Settings
After the basics, adjust high-traffic options:
- Hardware transcoding: Requires an Intel iGPU or NVIDIA card with VAAPI.
Enable in Settings > Server > Transcoder (requires Plex Pass). - Library scan interval: Reduce disk churn for large libraries, schedule checks for off-peak hours.
- Remote Access: Verify configuration via the Web UI; test via LTE/offsite connection (some routers require manual NAT).
Non-obvious tip:
Set your Plex Media Server
data directory (/var/lib/plexmediaserver/Library/Application Support/Plex Media Server
) on an SSD. For large installations, HDD seek times will bottleneck metadata browsing.
Practical Automation Example: Scheduled Library Scan
Leverage cron
to trigger nightly rescan (example for Movies):
sudo -u plex /usr/lib/plexmediaserver/Plex\ Media\ Scanner --scan --section 1
Replace 1
with section ID from your library list (found via Plex logs or API).
Backups and Monitoring
- Configs and metadata:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/
- Use
rsync
orborg
for point-in-time copies. - Monitor service health:
Side note: Third-party tools likesystemctl is-active plexmediaserver || echo "Plex has crashed"
plex-top
expose real-time transcode/load stats for deeper operational monitoring.
Concluding Note
A well-configured Plex server on current Ubuntu LTS is stable and resource-efficient for multi-user streaming. Expect to revisit permissions when moving storage and, for optimal experience at scale, always separate OS, app, and media storage.
Alternative stack exists (Emby, Jellyfin)—but for metadata agents and client compatibility, Plex remains the pragmatic default.
Questions, errors, or edge-case hardware? Start with logs; most Plex issues are traceable with careful review.