How to Self-Host Plex on a VPS
In this article
This guide walks you through setting up a Plex Media Server on a Virtual Private Server (VPS), giving you a centralized, always-on media library accessible from anywhere. You'll need a VPS with a public IP address, SSH access, and a Plex account. By the end, you'll have a fully functional Plex server that streams your media to any device.
What You'll Need
- A VPS with at least 2 CPU cores, 2GB RAM, and 50GB storage (more storage if you plan to store media locally).
- SSH client (e.g., Terminal on macOS/Linux, PuTTY on Windows).
- A Plex account (free to create at plex.tv).
- Basic familiarity with Linux command line.
- Media files (movies, TV shows, music) either on the VPS or accessible via network storage.
Step-by-Step
- Connect to your VPS: Open your SSH client and log in as root or a user with sudo privileges. For example:
ssh root@your_server_ip. - Update the system: Run
sudo apt update && sudo apt upgrade -y(for Debian/Ubuntu) orsudo dnf update -y(for CentOS/RHEL). This ensures you have the latest security patches. - Install required packages: Install
wget,curl, andgnupgif not already present:sudo apt install wget curl gnupg -y. - Add the Plex repository: For Debian/Ubuntu, run:
wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add - echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
For CentOS/RHEL, use the official RPM repository instructions from the Plex website. - Install Plex Media Server: Run
sudo apt update && sudo apt install plexmediaserver -y. On CentOS, usesudo dnf install plexmediaserver. - Start the service: Enable and start Plex with
sudo systemctl enable plexmediaserver && sudo systemctl start plexmediaserver. - Create a media directory: Create a folder for your media, e.g.,
sudo mkdir -p /var/lib/plexmediaserver/media. Set ownership:sudo chown -R plex:plex /var/lib/plexmediaserver/media. - Upload your media: Use
scporrsyncto transfer files from your local machine to the VPS. Example:rsync -av /path/to/local/movies/ root@your_server_ip:/var/lib/plexmediaserver/media/movies/. - Access the Plex web interface: In a browser, go to
http://your_server_ip:32400/web. If you have a firewall, allow port 32400:sudo ufw allow 32400(if using UFW). - Claim your server: On first access, you'll be prompted to sign in with your Plex account. After signing in, Plex will automatically claim the server.
- Add your media libraries: In the Plex web interface, go to Settings → Manage → Libraries → Add Library. Choose the type (Movies, TV Shows, etc.), then add the folder path (e.g.,
/var/lib/plexmediaserver/media/movies). Plex will scan and organize your media. - Enable remote access: In Settings → Remote Access, ensure it's enabled. Plex will attempt to set up a secure connection automatically. If you have a static IP, it should work out of the box.
- Optional: Set up a reverse proxy: For added security and to use a custom domain, install Nginx and configure a proxy to forward requests to
localhost:32400. This step is recommended if you want to access Plex via HTTPS.
Common Mistakes
- Firewall blocking port 32400: Many VPS providers have a default firewall. Ensure port 32400 is open in both the OS firewall and the provider's security group/network firewall.
- Insufficient storage: Media files are large. Check your VPS's storage and plan accordingly. If you run out of space, Plex may fail to scan or transcode.
- Using the wrong repository: Adding the wrong Plex repo for your OS version can cause installation errors. Always follow the official instructions for your distribution.
- Not setting directory permissions: Plex runs as the
plexuser. If the media folder is not readable by that user, libraries will appear empty. - Skipping the claim step: If you don't sign in and claim the server, you won't be able to access it remotely or manage it properly.
Tips
- Use a VPS with a fast CPU: Transcoding (converting video on the fly) is CPU-intensive. A VPS with multiple cores will handle multiple streams better.
- Store media on external storage: If your VPS has limited storage, consider mounting an external storage service (like S3) via rclone, but be aware of bandwidth and latency.
- Enable automatic updates: Keep Plex updated to get new features and security fixes. You can set up a cron job to run
sudo apt update && sudo apt upgrade -yweekly. - Use a dedicated domain: If you have a domain, set up a subdomain like
plex.yourdomain.comwith a reverse proxy for easier access and SSL. - Backup your Plex configuration: Regularly back up
/var/lib/plexmediaserverto avoid losing your library metadata and settings.
Troubleshooting
- Can't access the web interface: Check if Plex is running:
sudo systemctl status plexmediaserver. If not, start it. Also check that port 32400 is listening:sudo netstat -tulpn | grep 32400. - Remote access not working: Verify your VPS's public IP is reachable. Try accessing
http://your_ip:32400/webfrom a different network. If it fails, check the firewall and ensure Plex's remote access setting shows 'Fully accessible'. - Libraries show no content: Confirm the media folder path is correct and that the
plexuser has read permissions. Runsudo -u plex ls /path/to/mediato test. - Installation fails: If the repo isn't working, download the .deb or .rpm package directly from Plex's website and install manually with
sudo dpkg -i plexmediaserver*.deborsudo rpm -i plexmediaserver*.rpm. - High CPU usage: Transcoding is CPU-heavy. Check which streams are active in the Plex dashboard. Consider lowering playback quality or using direct play if possible.
- Plex says 'Server is not available': This often means the server is not claimed. Go to
http://your_ip:32400/weband sign in again. If that fails, restart Plex:sudo systemctl restart plexmediaserver.
Frequently Asked Questions
Can I use a free VPS for Plex?
Free VPS tiers usually have too little CPU and storage for a smooth Plex experience. A low-cost paid VPS is recommended.
How much bandwidth does Plex use?
It depends on the stream quality. A 1080p stream can use 8-10 Mbps, so ensure your VPS has sufficient bandwidth allocation.
Can I install Plex on a VPS running Windows?
Yes, Plex supports Windows Server, but Linux is more common and often cheaper for VPS hosting.
Is it legal to host Plex on a VPS?
Hosting your own media is legal, but streaming copyrighted content without permission is not. Ensure you have the rights to the media you store.
How do I update Plex on my VPS?
Run sudo apt update && sudo apt upgrade plexmediaserver (or sudo dnf update plexmediaserver). Alternatively, download the latest package from Plex's website.
Can I use a VPS with a dynamic IP?
Yes, but remote access may break when the IP changes. Use a dynamic DNS service to map a domain to your changing IP.