Plex Media Server is one of the most popular solutions for media management and streaming. With Plex, you can store and stream media content to any device, be it your phone, tablet, smart TV, or computer. Setting up Plex on a VPS allows you to create your own cloud-based media server, giving you secure and remote access to your media library. This guide will show you how to install Plex on an Ubuntu 20.04 LTS VPS.
Step 1: Set Up Your VPS
-
Choose a VPS
- For Plex Media Server, ensure your VPS has at least 2GB of RAM and sufficient storage space for your media library. A VPS with a good CPU (at least 2 cores) is recommended for smooth media streaming.
- Make sure your VPS is running Ubuntu 20.04 LTS or a later version.
-
Access Your VPS via SSH
- Once your VPS is created, access it through SSH:
-
Update Your VPS
- Before installing Plex, update your system to ensure all software packages are up-to-date:
Step 2: Install Plex Media Server on Ubuntu
-
Add Plex Repository and Install Dependencies
- Plex provides an official repository for Ubuntu, so you can easily install it via the package manager. First, install required dependencies:
-
Add Plex Repository
- Download and add the Plex repository to your system:
-
Add Plex Source
- Add the Plex repository to the APT sources list:
-
Update Your System
- Now, update your package list to include the Plex repository:
-
Install Plex Media Server
- Install Plex Media Server using the following command:
Step 3: Configure Plex Media Server
-
Start Plex Media Server
- Plex Media Server should start automatically after installation. However, if it doesn't, you can start it manually with the following command:
-
Enable Plex to Start on Boot
- To ensure Plex starts automatically when your server reboots, enable it using:
-
Check the Plex Service Status
- To verify Plex is running, check its status:
Step 4: Set Up Plex Media Server
-
Access Plex Web Interface
- Plex is configured through a web-based interface. Open a web browser and navigate to:
- Replace
your-vps-ip
with the actual IP address of your VPS. - You should see the Plex setup screen. Sign in with your Plex account or create a new one if you don’t have one.
-
Configure Media Folders
- Plex will prompt you to add media libraries. These are the folders where your movies, music, TV shows, and other media files are stored.
- Click Add Library and choose the type of media you want to add (Movies, TV Shows, Music, etc.).
- Select the folder on your VPS where the media files are located.
- Plex will prompt you to add media libraries. These are the folders where your movies, music, TV shows, and other media files are stored.
-
Configure Server Settings
- Customize settings like server name, remote access, and security in the Plex settings page.
- It’s recommended to set up Remote Access so you can stream your media anywhere. If you face issues with remote access, you can configure port forwarding on your VPS or use Plex's NAT/UPnP feature.
Step 5: Add Media to Plex
-
Upload Media to Your VPS
- Upload your media files to the designated folders on your VPS. This can be done using an FTP client (like FileZilla) or using SSH commands to move files.
-
Update Your Plex Libraries
- After adding media, go to the Plex web interface and click the Refresh button in your library section to ensure Plex detects and indexes all new files.
Step 6: Configure SSL for Secure Access (Optional but Recommended)
To make sure your connection to Plex is secure, it’s a good idea to enable HTTPS using SSL certificates.
-
Install Certbot
- Install Certbot, which is used to get free SSL certificates from Let's Encrypt:
-
Obtain SSL Certificate
- Run the following command to obtain an SSL certificate for your domain (if you have one set up for your VPS):
-
Auto-Renew SSL Certificate
- Certbot automatically renews your SSL certificates. To test this, run:
Step 7: Install Plex Media Server Apps (Optional)
Plex provides mobile and desktop apps for various devices (iOS, Android, Roku, Apple TV, Smart TVs, etc.). You can install the Plex app on any of these devices to start streaming media from your VPS.
-
Install Plex on Your Devices
- Go to the Plex website or respective app stores (Google Play, Apple App Store, etc.) and download the Plex app for your device.
-
Log in to Your Plex Account
- Open the Plex app on your device, and log in using the same Plex account you used for the server.
-
Start Streaming
- Once logged in, you should be able to stream all the media stored on your Plex server, right from your mobile device, tablet, or TV.
Step 8: Maintain and Back Up Your Plex Server
-
Regular Backups
- It’s important to back up your Plex server settings and metadata regularly. You can do this by copying the Plex data directory (
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/
) to a safe location.
- It’s important to back up your Plex server settings and metadata regularly. You can do this by copying the Plex data directory (
-
Update Plex Media Server
- To ensure your Plex server is up to date with the latest features and security patches, run:
-
Monitor Server Performance
- Use
htop
ortop
to monitor the performance of your Plex server:
- Use
Step 9: Troubleshooting
-
Plex Won’t Start?
- Check the Plex logs for errors located at
/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Logs/
. - Restart Plex using:
- Check the Plex logs for errors located at
-
Remote Access Not Working?
- If you have issues with remote access, make sure that port 32400 is open in your VPS firewall and, if necessary, configure port forwarding or use Plex's NAT/UPnP feature.
Conclusion
Congratulations! You've successfully installed and set up Plex Media Server on your VPS. You now have your own private streaming server that can be accessed from anywhere. Plex allows you to organize, share, and stream all your media content securely. With mobile apps and smart TV integration, you can enjoy your media on a wide range of devices.
For even better performance, ensure that your VPS has enough storage space and processing power, especially if you plan to stream in high-quality resolutions like 4K. Plex also supports a wide range of plugins and customization options to enhance your media experience further.