Ultimate Guide to Setting Up Plex Media Server on Ubuntu

Ready to create your personal Netflix-like streaming service? This comprehensive guide will walk you through the process of setting up your own Plex Media Server on Ubuntu. Whether you’re a media enthusiast or just looking to organize your digital library, we’ve got you covered.

Prerequisites

Before we begin, ensure you have:

  1. An Ubuntu server (20.04 LTS or newer recommended)
  2. Root or sudo access to your server
  3. At least 2GB of RAM (4GB or more recommended for transcoding)
  4. Sufficient storage space for your media files
  5. A stable internet connection

Need a reliable server to host your Plex Media Server? Check out Servers Guru for high-performance media servers at competitive prices.

Step 1: Update Your System

First, let’s ensure your system is up-to-date:

sudo apt update
sudo apt upgrade -y

Step 2: Add the Plex Repository

To get the latest version of Plex, we need to add its official repository:

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

Step 3: Install Plex Media Server

Now, let’s install Plex:

sudo apt update
sudo apt install plexmediaserver -y

Step 4: Configure Firewall

If you’re using UFW (Uncomplicated Firewall), allow the Plex ports:

sudo ufw allow 32400/tcp
sudo ufw reload

Note: If you’re using a cloud hosting provider like Servers Guru, you may need to configure these ports in their firewall settings as well.

Step 5: Set Up Plex Media Server

  1. Access the Plex web interface by navigating to http://YOUR_SERVER_IP:32400/web in your browser.

  2. Sign in or create a Plex account if you don’t have one.

  3. Follow the on-screen setup wizard:

    • Name your server
    • Add your media libraries (Movies, TV Shows, Music, etc.)
    • Choose your media folders

Step 6: Optimize Plex Performance

For optimal performance, consider the following:

  1. Transcoder Temporary Directory: By default, Plex uses /tmp for transcoding. For better performance, especially on systems with SSDs:

    sudo mkdir -p /opt/plex/transcode
    sudo chown plex:plex /opt/plex/transcode
    

    Then, in the Plex settings (Transcoder section), set the “Transcoder temporary directory” to /opt/plex/transcode.

  2. Hardware Transcoding: If your server has a compatible GPU, enable hardware transcoding in the Plex settings for better performance.

  3. Network Settings: In the Plex settings, under Network, you can adjust the LAN and WAN bandwidth limits based on your server’s capabilities and internet connection.

Step 7: Set Up Remote Access

To access your Plex server from outside your home network:

  1. In Plex settings, go to “Remote Access”
  2. Click “Enable Remote Access”
  3. If you’re behind a router, you may need to set up port forwarding for port 32400

Step 8: Regular Maintenance

To keep your Plex Media Server running smoothly:

  1. Update Plex: Regularly update Plex using:

    sudo apt update
    sudo apt upgrade plexmediaserver -y
    
  2. Backup Your Database: Regularly backup your Plex database located at /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/

  3. Monitor System Resources: Use tools like htop to ensure your server isn’t overloaded.

Optimizing Your Plex Media Server

For the best streaming experience, consider these tips:

  1. Allocate Sufficient Resources: Ensure your server has enough CPU and RAM, especially if you plan on doing a lot of transcoding. Servers Guru offers a range of high-performance options tailored for media streaming.

  2. Use Direct Play When Possible: Organize your media and use client apps that support direct play to reduce the load on your server.

  3. SSD for Metadata: If possible, store your Plex metadata on an SSD for faster loading times.

  4. Gigabit Ethernet: For the best local streaming performance, use a wired gigabit ethernet connection.

Conclusion

Congratulations! You now have your own Plex Media Server up and running on Ubuntu. With this setup, you can stream your media collection to any device, anytime, anywhere. Remember, a great streaming experience starts with a reliable server. If you’re looking for top-notch performance and 24/7 support, consider hosting your Plex Media Server with Servers Guru.

Enjoy your personal streaming service, and happy watching!