So you want to build a Plex server?
Setting up and maintaining a Plex server can enhance your media experience by providing seamless access to your media library from anywhere. In this guide, we'll go through the essential steps to build, maintain, and optimize your Plex server. Below, Iโll use my experience to walk you through each step.
1. Choosing the Operating System
For my Plex server, I chose Ubuntu as the operating system. Itโs widely used in the community and offers high functionality. Ubuntu's robust support for open-source applications and ease of configuration makes it ideal for hosting a media server.
2. Hardware Considerations
I wanted to find a cost-effective solution, so I purchased an old enterprise workstation from eBay for around $250. This provided a solid base to build upon, and I made some upgrades:
- RAM: I upgraded to 32GB to handle multiple streams and media processing tasks.
- Graphics Card: I added a Quadro P600, which is not only cost-effective but also energy-efficient, enabling me to handle transcoding smoothly.
CPU and Memory: Plex isn't extremely CPU-heavy, but it can be memory-hungry. With 8 cores and 32GB of RAM, Iโm able to stream multiple 4K videos at once without issue.
3. Storage Setup
Storage is a crucial element. I initially started with 1TB, but as my media library expanded, I realized this wasnโt enough. Eventually, I upgraded to 40TB of storage, which is more than enough for my music and movie library.
Hereโs my storage configuration:
- OS Storage: I run Ubuntu on a 1TB SSD for speed and reliability.
- Media Storage: For media, I use 7200 RPM platter drives, which are perfect for streaming multiple high-quality videos without bottlenecking.
4. Switching to Docker
Initially, I installed Plex manually. However, after being introduced to Docker by a friend, I switched to using Docker containers. Docker provides numerous benefits for running Plex:
- Containerization: Plex runs in a completely isolated environment, which improves system stability and flexibility.
- Resource Limiting: Containers allow you to limit the resources Plex consumes, ensuring it doesnโt overrun other services.
- Security: Docker enhances security by keeping the Plex server separate from the host system, preventing potential security breaches.
Using Portainer further simplified managing these containers. Portainer provides a GUI to easily create, manage, and update Docker containers, making the whole process smoother than ever.
5. Network Configuration with Nginx Proxy Manager
To handle web traffic securely and efficiently, I use Nginx Proxy Manager (NPM). This runs in its own Docker container and manages all incoming web traffic to the Plex server.
NPM simplifies setting up reverse proxies and SSL certificates, ensuring that all traffic is encrypted and routed correctly.
Learn more about installing Nginx Proxy Manager in a Docker container.<<
6. Optimizing Plex Performance
Optimizing Plex required some initial experimentation. A big consideration was the choice between h264 and h265 codecs.
- h264 is widely supported but takes up more space.
- h265 offers better compression (half the storage size) while maintaining the same video quality, but older devices donโt support it.
To solve this, I utilized the Quadro P600, which is low cost, low power, and capable of transcoding multiple streams simultaneously. This setup allows me to transcode h265 to h264 for older clients while streaming h265 to newer clients.
Additionally, I optimized my media library by preprocessing the videos with Tdarr. Tdarr is a powerful tool that automatically transcodes and optimizes media files.