How to Install Plex Media Server on Ubuntu 24.04 — Stream Your Library Anywhere
Running your own Plex Media Server turns a VPS into a private Netflix for your family: your movies, TV shows, music, and photos, available on any device, anywhere in the world, without handing your collection to a third-party streaming service. This tutorial walks you through installing Plex on Ubuntu 24.04 from the official Plex repository, claiming the server to your account, organizing libraries, enabling hardware transcoding, and publishing the web UI securely through an Nginx reverse proxy with TLS.
Ideal plan for Plex: the CloudCore Professional VPS at EUR 19.99/month gives you 6 vCPU, 12 GB RAM, 100 GB NVMe, and unmetered bandwidth — enough for 3-5 concurrent 1080p streams with transcoding headroom.
Table of Contents
What is Plex Media Server?
Plex Media Server is a self-hosted media platform that organizes your personal video, audio, and photo collection and streams it to a huge ecosystem of client apps: iOS, Android, Apple TV, Roku, Fire TV, Samsung and LG smart TVs, game consoles, web browsers, and desktops. The server does the heavy lifting — fetching artwork, subtitles, and metadata from TheMovieDB, TheTVDB, and MusicBrainz, then serving files to clients in whatever format each device supports, transcoding on the fly when needed.
Under the hood Plex ships a bundled build of FFmpeg, an HTTP API on port 32400, an embedded database, and a web application you manage entirely in the browser. The workflow is simple: drop a file into /mnt/media/Movies/The Matrix (1999)/The Matrix.mkv, Plex detects the new file within seconds, fetches a poster, cast list, trailer, and chapter thumbnails, and makes it instantly playable on every device signed into your Plex account.
Why Self-Host Plex on a VPS?
Running Plex on a VPS instead of a home NAS or desktop solves several real-world problems at once:
- Remote access for family without VPN — A VPS has a public IP on a datacenter backbone, so relatives in another city or country stream directly from your server with no ISP port-forwarding, no dynamic DNS, and no "my dad's internet is down again" calls.
- No ISP upload throttling — Residential connections typically cap upload bandwidth at 20-40 Mbps, which means two 4K streams saturate the pipe. A VPS with a symmetric 1 Gbps link easily handles many concurrent viewers.
- Always-on availability — Your laptop sleeps, your home PC reboots for Windows updates, your NAS enters energy-saving mode. A VPS runs 24/7 with datacenter power redundancy, so family members can watch whenever they want.
- Quiet and cool at home — Transcoding a 4K file on a desktop spins fans up to jet-engine levels. Offloading to a VPS keeps your apartment quiet and your electricity bill predictable.
- Separation of content and hardware — Storage on the VPS is independent of any single device. Your collection survives laptop upgrades, motherboard failures, and house moves.
- Control over updates and privacy — You decide when to update Plex, what data you share with plex.tv, and whether to route playback through the Plex Relay or directly to clients.
- Flat, predictable monthly cost — A VPS is a known line item on your card. No surprise bills, no tiered streaming quality, no "region not available" messages for your own files.
Plex on VPS vs. Commercial Streaming Services
| Feature | Plex on VPS | Netflix / Disney+ / Prime |
|---|---|---|
| Monthly cost | EUR 19.99 (flat, unlimited users) | EUR 10-20 per service, per month |
| Catalog | Your own collection, permanent | Rotating, titles disappear |
| Regional restrictions | None | Country-locked catalogs |
| Concurrent streams | Limited by VPS bandwidth | 1-4 depending on plan |
| Download for offline | Yes (Plex Pass) | Varies by service |
| Ads | None | Ad-supported tiers |
| Data privacy | You own the server | Viewing history harvested |
Prerequisites
Before you start, make sure you have:
- A VPS running Ubuntu 24.04 LTS with root or sudo access
- SSH access to the server
- A plex.tv account (free — create one before the claim step)
- At least 2 GB of RAM (4 GB+ recommended for transcoding)
- Enough disk space for your media (50 GB for a small library, 1 TB+ for a serious collection)
- A domain name pointing at your VPS (for the TLS reverse proxy section)
Recommended Plan: CloudCore Professional>
Plex is comfortable on the Professional VPS:>
- 6 vCPU cores
- 12 GB RAM
- 100 GB NVMe SSD (plus optional block storage for library growth)
- Unmetered 1 Gbps bandwidth
- EUR 19.99/month>
This plan streams 3-5 simultaneous 1080p transcoded sessions without breaking a sweat. For all-direct-play setups you can scale down; for heavy 4K HDR tone-mapping, scale up.
Connect via SSH:
ssh root@your-server-ipStep 1: Update the System
Refresh package metadata and apply pending security updates so the Plex install runs against an up-to-date base system.
sudo apt update && sudo apt upgrade -yIf the kernel was updated, reboot before continuing:
sudo rebootReconnect once the VPS comes back online.
Step 2: Add the Official Plex Repository
Plex maintains an apt repository at downloads.plex.tv. Adding it means Plex updates arrive through the standard apt upgrade flow alongside the rest of your system.
Install the dependencies needed to trust and fetch HTTPS repositories:
sudo apt install -y curl gnupg apt-transport-https ca-certificatesImport the Plex package signing key into /etc/apt/keyrings (the modern, per-repo keyring location):
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://downloads.plex.tv/plex-keys/PlexSign.key \
| sudo gpg --dearmor -o /etc/apt/keyrings/plex.gpgAdd the repository entry, pinning it to the keyring you just imported:
echo "deb [signed-by=/etc/apt/keyrings/plex.gpg] https://downloads.plex.tv/repo/deb public main" \
| sudo tee /etc/apt/sources.list.d/plexmediaserver.listRefresh apt so it sees the new source:
sudo apt updateExpected output includes a line similar to:
Get:5 https://downloads.plex.tv/repo/deb public InRelease [7,434 B]No warnings about missing keys should appear. If you see NO_PUBKEY, the keyring step failed — re-run the curl ... gpg --dearmor command.
Step 3: Install Plex Media Server
Install the server package:
sudo apt install -y plexmediaserverThe package installs the Plex binary, a systemd unit, a dedicated service user, and the FFmpeg-based transcoder. Once installation finishes, systemd starts the service automatically.
Verify the service is active:
sudo systemctl status plexmediaserverExpected output:
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; preset: enabled)
Active: active (running) since Thu 2026-04-16 09:00:00 UTC; 5s ago
Main PID: 2345 (sh)
Tasks: 24 (limit: 14236)
Memory: 180.0M
CPU: 3.120sEnable it to start on boot (the installer usually does this already):
sudo systemctl enable plexmediaserverStep 4: Understand the Service User and Paths
The apt package creates a dedicated system user named plex. This user runs the server and needs read access to your media directories.
Key paths to know:
- Binary:
/usr/lib/plexmediaserver/Plex Media Server - Configuration, database, metadata:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/ - Default transcode temp dir:
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Cache/Transcode - Environment file (port, user, prefs dir):
/etc/default/plexmediaserver - systemd unit:
/lib/systemd/system/plexmediaserver.service
plex user and group. A single parent with per-type subfolders keeps permissions clean:sudo mkdir -p /mnt/media/{Movies,TV,Music,Photos}
sudo chown -R plex:plex /mnt/media
sudo chmod -R 755 /mnt/mediaIf you mount a block storage volume later, mount it at /mnt/media and re-run the chown so the plex user retains access.
Step 5: Open the Web UI and Claim the Server
Plex's web UI lives on port 32400 but, by design, only accepts direct connections from 127.0.0.1 during initial setup. To claim the server from your laptop, use an SSH tunnel.
From your local machine (not the VPS), open a tunnel:
ssh -L 32400:localhost:32400 root@your-server-ipKeep that terminal open. In your browser, visit:
http://localhost:32400/webYou will be redirected to plex.tv to sign in. Sign in (or create an account), and Plex automatically claims the server to your account — this is what binds the VPS instance to your identity and enables remote access, sharing, and the official mobile apps.
Important: the claim must happen via localhost or a known-private IP. If you try to reach the web UI through the VPS's public IP before claiming, Plex's security model will refuse and show "Not authorized." Always tunnel, claim, and then optionally open remote access.During the setup wizard, Plex asks you to:
HomePlex or FamilyStreamer)Finish the wizard. Your server is now registered to your Plex account.
Step 6: Create Your Libraries
Plex organizes media into libraries — typed folders the scanner understands. Each library uses a specific agent to fetch metadata (TheMovieDB for movies and TV, MusicBrainz for music, local EXIF for photos).
Recommended File Layout
Plex's scanner expects a predictable structure. Use this layout on your VPS:
/mnt/media/
├── Movies/
│ ├── The Matrix (1999)/
│ │ └── The Matrix (1999).mkv
│ └── Inception (2010)/
│ └── Inception (2010) {imdb-tt1375666}.mkv
├── TV/
│ └── Breaking Bad/
│ ├── Season 01/
│ │ ├── Breaking Bad - S01E01 - Pilot.mkv
│ │ └── Breaking Bad - S01E02 - Cat in the Bag.mkv
│ └── Season 02/
├── Music/
│ └── Radiohead/
│ └── OK Computer (1997)/
│ ├── 01 - Airbag.flac
│ └── 02 - Paranoid Android.flac
└── Photos/
└── 2026/
└── April/Include the release year in parentheses for movies and the Season XX convention for TV — this dramatically improves metadata match accuracy.
Adding the Libraries in the UI
In the Plex web UI, click Settings → Manage → Libraries → Add Library:
/mnt/media/Movies/mnt/media/TV/mnt/media/Music/mnt/media/PhotosUnder Advanced for each library, enable Run a partial scan when changes are detected so new files appear without waiting for the nightly full scan.
Drop a sample file into the appropriate folder. Within 10-30 seconds, it should appear in the library with poster art, description, and cast.
Uploading Media to the VPS
Three common methods:
- rsync from a local NAS over SSH — efficient for large collections
rsync -avh --progress /local/Movies/ plex@your-server-ip:/mnt/media/Movies/- SFTP via FileZilla or WinSCP — friendly for ad-hoc uploads
- rclone from a cloud bucket — good for consolidating from Google Drive, Backblaze B2, or S3
Step 7: Configure Hardware Transcoding
Transcoding converts a file from one format to another on the fly so an incompatible client can play it. Software transcoding is CPU-heavy — a single 1080p stream can consume 2-3 vCPU cores. Hardware transcoding offloads this to a dedicated video engine: an Intel iGPU's Quick Sync Video, an NVIDIA NVENC block, or an AMD VCN unit. The result is 5-10 simultaneous transcodes on hardware that would choke doing one in software.
Hardware transcoding requires a Plex Pass subscription. The free tier does software transcoding only. If you will only stream to devices that direct-play your files (identical codec and container), you can skip this section entirely.
Option A: Intel Quick Sync Video (Intel CPUs)
Most modern Intel CPUs include an iGPU with Quick Sync. Many VPS hypervisors do not pass the iGPU through to the VM, so verify device availability first:
ls /dev/driIf you see card0 and renderD128, Quick Sync is exposed. If the directory is empty or missing, your hypervisor is not passing through the video engine — in which case use software transcoding or pick a VPS plan that explicitly advertises GPU passthrough.
Install the Intel media driver and VA-API tooling:
sudo apt install -y intel-media-va-driver-non-free vainfoVerify VA-API sees the hardware:
vainfoYou should see a list of supported profiles including H264, HEVC, and VP9.
Grant the plex user access to the render node:
sudo usermod -aG render plex
sudo systemctl restart plexmediaserverIn Plex web UI → Settings → Transcoder, enable:
- Use hardware acceleration when available
- Use hardware-accelerated video encoding (Plex Pass only)
(hw) next to the video codec.Option B: NVIDIA GPU
If your VPS has an NVIDIA GPU, install the drivers:
sudo apt install -y nvidia-driver-550
sudo rebootAfter reconnecting, confirm the GPU is visible:
nvidia-smiEnable hardware transcoding in Settings → Transcoder the same way as the Intel path. Plex auto-detects NVENC on supported GPUs. Consumer NVIDIA drivers historically limited simultaneous NVENC sessions; the latest drivers lift this cap.
Transcode Directory on Fast Storage
Transcoding writes a lot of small temp files. Move the transcode folder to a ramdisk-like location for a noticeable speed boost:
sudo mkdir -p /var/lib/plexmediaserver/transcode-tmp
sudo chown plex:plex /var/lib/plexmediaserver/transcode-tmpThen in Settings → Transcoder → Show Advanced, set Transcoder temporary directory to /var/lib/plexmediaserver/transcode-tmp. On NVMe this already sits on fast storage; on servers with 16 GB+ RAM, mount a tmpfs there for maximum throughput.
Step 8: Nginx Reverse Proxy with TLS
Exposing Plex directly on the public IP works, but a reverse proxy with a real certificate on your own domain gives you:
- a friendly URL like
https://plex.example.com - an automatically renewing Let's Encrypt certificate
- a single TLS termination point alongside your other services
- finer control over access logging and rate limiting
sudo apt install -y nginx certbot python3-certbot-nginxAllow the Proxy Hostname in Plex
Plex validates the Host header. You must tell Plex that plex.example.com is a trusted custom URL, otherwise the web UI will refuse to load behind the proxy.
Two options: set Custom server access URLs in Settings → Network, and add a custom.conf in Plex's Preferences directory if you need to override interface bindings.
sudo mkdir -p "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences"
sudo tee "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences/custom.conf" > /dev/null <<EOF
allowedNetworks=127.0.0.1/32,::1/128
customConnections=https://plex.example.com:443
EOF
sudo chown -R plex:plex "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences"
sudo systemctl restart plexmediaserverAlso enter https://plex.example.com in Settings → Network → Custom server access URLs.
Nginx Configuration
Create the site file:
sudo tee /etc/nginx/sites-available/plex > /dev/null <<'EOF' server { listen 80; server_name plex.example.com; return 301 https://$host$request_uri; }server { listen 443 ssl http2; server_name plex.example.com;
ssl_certificate /etc/letsencrypt/live/plex.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/plex.example.com/privkey.pem;
# Security headers add_header X-Content-Type-Options nosniff always; add_header X-Frame-Options SAMEORIGIN always; add_header Referrer-Policy no-referrer-when-downgrade always;
# Plex uses large chunks for media streaming client_max_body_size 100M; send_timeout 100m;
# WebSocket and streaming require long timeouts proxy_read_timeout 36000s; proxy_send_timeout 36000s;
# Disable buffering for live streams proxy_buffering off; proxy_request_buffering off;
location / { proxy_pass http://127.0.0.1:32400;
proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Plex-Client-Identifier $http_x_plex_client_identifier; proxy_set_header X-Plex-Device $http_x_plex_device; proxy_set_header X-Plex-Device-Name $http_x_plex_device_name; proxy_set_header X-Plex-Platform $http_x_plex_platform; proxy_set_header X-Plex-Product $http_x_plex_product; proxy_set_header X-Plex-Token $http_x_plex_token; proxy_set_header X-Plex-Version $http_x_plex_version; } } EOF
Enable the site and obtain a certificate:
sudo ln -s /etc/nginx/sites-available/plex /etc/nginx/sites-enabled/
sudo nginx -t
sudo certbot --nginx -d plex.example.com
sudo systemctl reload nginxCertbot installs a systemd timer that renews the certificate automatically.
Step 9: Open the Right Firewall Ports
Keep the Plex native port (32400) closed to the internet; all external traffic should flow through Nginx on 443. If you use UFW:
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw deny 32400/tcp
sudo ufw enable
sudo ufw statusRemote clients connect via https://plex.example.com; the Plex apps discover the server through the plex.tv relay using your claimed account.
Plex Pass: Is It Worth It?
Plex Pass is the paid tier, available monthly, yearly, or as a one-time lifetime purchase. It unlocks:
- Hardware transcoding (the big one for VPS users)
- Live TV and DVR if you have a tuner
- Mobile sync (offline downloads to phones/tablets)
- Advanced user management with per-user library restrictions
- Plexamp full-featured music client
- Early access to new features
Maintenance and Backups
Updates
Plex updates flow through apt alongside Ubuntu security updates:
sudo apt update && sudo apt upgrade -y
sudo systemctl restart plexmediaserverBackups
Back up the Plex preferences directory nightly. It contains the database, metadata, watch history, and settings:
sudo systemctl stop plexmediaserver
sudo tar -czf /root/plex-backup-$(date +%F).tar.gz \
-C /var/lib/plexmediaserver/Library/Application\ Support \
"Plex Media Server"
sudo systemctl start plexmediaserverSchedule the above in a cron job and push the archive to off-site storage (S3, B2, another VPS) weekly. Restoring is the inverse: stop Plex, untar on a fresh VPS, chown back to plex:plex, start Plex.
Log Rotation
Plex logs under the preferences directory and rotates them internally. Check free disk occasionally:
df -h /var/lib/plexmediaserver
du -sh "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs"Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Web UI shows "Not authorized" on public IP | Server not yet claimed | Claim via SSH tunnel to localhost:32400/web first |
| Libraries don't scan new files | plex user lacks read permission on media dir | sudo chown -R plex:plex /mnt/media && sudo chmod -R 755 /mnt/media |
apt cannot find plexmediaserver | Repo not added or key missing | Re-run Step 2, confirm /etc/apt/sources.list.d/plexmediaserver.list exists |
| Hardware transcode falls back to software | /dev/dri missing or user not in render group | ls /dev/dri, sudo usermod -aG render plex, restart service |
| 502 Bad Gateway from Nginx | Plex not running or listening on wrong port | sudo systemctl status plexmediaserver, check curl http://127.0.0.1:32400/identity |
| Remote apps can't find server | Firewall blocking 443 or custom URL not set | Check UFW, set customConnections in custom.conf and Settings → Network |
| Buffering on remote streams | Transcode bitrate too high for viewer's link | Lower Remote Streaming Quality per user, or enable "Use original quality" only on fast links |
Useful Log Commands
# Tail the systemd journal
sudo journalctl -u plexmediaserver -fTail Plex's own log
sudo tail -f "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/Plex Media Server.log"For anything not covered here, Plex's own support portal has extensive articles and an active community forum.
FAQ
Do I need Plex Pass to run Plex Media Server on a VPS?
No. Plex Media Server itself is free for personal use and includes library management, metadata fetching, local streaming, and basic remote streaming. Plex Pass is an optional paid upgrade that unlocks hardware transcoding, live TV and DVR, mobile sync, and Plexamp. If your viewers use capable clients that direct-play your files, the free tier is enough. If you stream to many devices that need transcoding, Plex Pass pays for itself in reduced CPU load.
Is hosting Plex on a VPS legal?
Running Plex Media Server on a VPS is legal when you stream content you legally own or have licensed — ripped Blu-rays you own, purchased digital files, music from your CD collection, home videos. What you cannot do is upload commercial media you don't own, or resell access. That breaches copyright law and the Plex Terms of Service. Always host your own legitimately acquired content.
How much bandwidth does Plex actually use?
A direct-play 1080p stream uses 4-10 Mbps, a 4K HDR stream 40-80 Mbps, and transcoded 1080p streams typically 3-6 Mbps depending on the target quality. Three concurrent 1080p transcoded streams comfortably fit within 20 Mbps of upload. On an unmetered 1 Gbps VPS you can support many concurrent viewers before bandwidth becomes the bottleneck — transcoding CPU/GPU is usually the first limit you hit.
Will Plex work behind an Nginx reverse proxy?
Yes. Plex works well behind Nginx as long as you forward the WebSocket upgrade headers, disable proxy buffering for streaming endpoints, and keep Plex's native port 32400 reachable on 127.0.0.1. You also need to register the proxy hostname either through Settings → Network → Custom server access URLs or via a custom.conf in Plex's Preferences directory. The configuration in Step 8 of this guide handles all of that.
Can I use Plex with Sonarr and Radarr for automation?
Yes, and it's one of the most popular setups. Sonarr tracks TV series and Radarr tracks movies; both integrate with download clients and save completed files into the same folders Plex watches. Configure Sonarr/Radarr to send a webhook to Plex on import so new episodes and movies surface instantly without waiting for the next scheduled scan. If you prefer a fully open-source media server, the same tools work equally well with Jellyfin.
Should I use Plex, Jellyfin, or Emby?
Plex has the broadest client ecosystem, the most polished apps, and the smoothest remote access experience out of the box — at the cost of some features sitting behind Plex Pass and some telemetry in the default configuration. Jellyfin is fully free and open-source with no paid tier and no telemetry, but its client apps are less uniformly polished. Emby sits between the two with its own paid Premiere plan. For a VPS where family members need a native app on every possible device, Plex is the path of least resistance. For a privacy-first, no-paywall setup, Jellyfin is the answer.
How do I back up my Plex server configuration?
Back up the directory /var/lib/plexmediaserver/Library/Application Support/Plex Media Server. That folder contains the database, metadata cache, artwork, watch history, user settings, and the Preferences.xml / custom.conf files. Stop the service, tar the folder, copy the archive off-server, and start Plex again. To restore on a fresh VPS: install Plex from the apt repo, stop the service, extract the archive, run chown -R plex:plex on the restored directory, and start the service. No library rescan is needed — every poster, watched flag, and user preference returns exactly as it was.
Next Steps
With Plex serving your library, these are the natural follow-ons:
- Automate acquisition with Sonarr and Radarr — see our Sonarr install guide and Radarr install guide for the full automation stack.
- Try a Plex alternative — if you hit Plex Pass friction, our Jellyfin install guide walks through the fully open-source equivalent. Our Emby install guide covers another option that shares much of Plex's design philosophy with a different licensing model.
- Add a request portal — install Overseerr so family members can request new titles and have Sonarr/Radarr fetch them automatically.
- Expand storage with block volumes — attach additional block storage to your VPS, mount at
/mnt/media, and watch Plex absorb the new capacity seamlessly. - Monitor playback and health — tools like Tautulli give you rich dashboards of who is watching what, plus alerts for server issues.
- Consult Plex's official docs — the Plex support portal has deep reference material for every advanced feature in this guide and beyond.
Need more streaming headroom?>
The CloudCore Professional VPS at EUR 19.99/month is the sweet spot for a family Plex server: 6 vCPU, 12 GB RAM, 100 GB NVMe, and unmetered bandwidth. For larger libraries or more concurrent viewers, our higher-tier plans add RAM, cores, and storage without changing the workflow in this guide.>
Launch your Plex VPS now and be streaming your own collection tonight.