โ† misc 3 min read
#Linux #Homelab

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:

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:


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:

Hereโ€™s a link to installing Docker on Ubuntu.<<

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.

Visit Portainer to learn more about its product.<<


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.

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.

You can learn more about Tdarr on their website.<<