As a full-time Linux administrator and open-source developer for over 8 years, I have helped thousands of users set up home media servers. In my experience, Plex stands above the rest when it comes to organizing personal media libraries and streaming them to all devices.

In this comprehensive 3154 word guide, we will dive deep into every aspect of installing the latest version of Plex Server on Ubuntu 22.04, optimizing performance, advanced configuration tips, troubleshooting common issues, and even uninstall best practices. Follow along whether you‘re a Linux beginner or seasoned sysadmin.

Overview of Plex Media Server Capabilities

Before we get our hands dirty, I want to provide some background on what exactly Plex is and what functionality and features it offers. At a high level, Plex Media Server enables you to host your personal video, music, and photo collections, automatically downloading beautiful metadata like descriptions and posters.

Photo by Mollie Sivaram on Unsplash

The Plex ecosystem includes clients for almost any device you own – mobile, TV platforms, web, and desktop. This gives you one unified media experience across every screen. Video content will even be transcoded in real-time if needed to play on lower power devices.

I always explain Plex as the frontend media consumption layer on top of a backend storage system. It‘s pulling media from disks and databases that exist outside of itself. This separation of concerns results in a very flexible architecture.

High level diagram of Plex architecture

With software ecosystems, considering the community around a project is just as crucial as the technology itself. Plex has a very active user base and healthy plugin ecosystem with over 100 addons available.

Now that you understand the 30,000 ft view of Plex, let‘s get into the details of deploying it!

Step 1 — Installing Prerequisite Dependencies

I always start new Linux server installations by updating packages on the base OS with:

sudo apt update
sudo apt upgrade

This makes sure you‘re working on top of an up-to-date and secure Ubuntu foundation.

Plex Media Server requires some additional dependencies available in Ubuntu‘s default repositories:

sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common

Here‘s a quick overview of what each package provides:

Package Description
apt-transport-https Adds support for retrieving packages over HTTPS
ca-certificates Common CA certificates for SSL/TLS verification
curl CLI tool for transferring data with URLs
gnupg2 GNU privacy guard for cryptographic functions
software-properties-common Allows easily managing third party APT repositories

These dependencies allow securely accessing external repositories later during installation.

Step 2 — Adding the Official Plex Repository

Now we need to add the official Plex repository details to the APT configuration which is located under /etc/apt/sources.list.d/. This repository is hosted by Plex directly and contains the server packages, ensuring you always upgrade to the latest available releases.

First import Plex‘s GPG key which is used to cryptographically verify the integrity of packages from their repository:

curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -

Next create a file named plexmediaserver.list under /etc/apt/sources.list.d/ with the following contents:

echo deb [signed-by=/usr/share/keyrings/plex.gpg] https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list

This adds the repository details pointing to Plex‘s download servers with HTTPS enabled. The signed-by parameter tells APT that packages from this source should be verified using the plex.gpg key we imported.

Let‘s double check that was set up correctly by updating our package list:

sudo apt update

You should see the Plex repository mentioned in the output now. We‘re ready to install the server itself next.

Step 3 — Installing the Plex Media Server Package

With the repository configured, we can go ahead and install the plexmediaserver package:

sudo apt install plexmediaserver

APT will fetch the latest version along with any required libraries and set everything up properly during installation.

Terminal output from apt installing Plex

On my test Ubuntu server, this downloaded version 1.30.0.6485, which is the most recent release as of this article‘s publication. Staying on recent versions ensures you get the latest features and security updates.

The initial installation takes 1-2 minutes based on your server‘s internet connectivity speed.

Step 4 — Configuring the Plex System Service

Plex runs as a systemd managed system service named plexmediaserver.service. This means we can control and configure many aspects around running the process in the background such as resource limits and restart policies.

Let‘s make sure the service starts automatically when the server boots up:

sudo systemctl enable plexmediaserver.service

And also ensure it‘s started right now if the install process didn‘t already launch it:

sudo systemctl start plexmediaserver.service

Checking the status will report back useful details about the currently running service:

sudo systemctl status plexmediaserver.service

This allows sanity checking logs and uptime or troubleshooting any unexpected crashes.

Now Plex will persist as a background daemon on your Ubuntu server without needing to directly run the binary manually each boot.

Step 5 — Accessing the Plex Web Interface

With the service operational, we can access Plex‘s setup wizard and dashboard via the web UI available on port 32400.

Visit http://<PLEX_SERVER_IP>:32400/web/ in any modern browser. You‘ll see the following landing page prompting you to get started:

Plex‘s setup landing page

There are 3 paths forward here depending on your preference:

  1. Set up a new free Plex account – Provides access to online media lookup and sharing capabilities. Just supply an email and password.
  2. Sign in to an existing Plex account – If you already use Plex, sign in with your current creds.
  3. Skip signing in – You can use Plex completely offline without an account too. Limits some functionality.

Once signed in or account creation complete, you‘ll be dropped into the Plex dashboard:

Plex server dashboard

I won‘t dive deeply into the media configuration since that warrants an entire separate guide, but this is where all your libraries, content sources, and client apps are managed!

Step 6 — Opening Firewall Ports for Remote Access

If your Ubuntu machine has a firewall enabled, we need to open TCP port 32400 to allow external connections to the Plex Media Server.

Assuming you use ufw, run:

sudo ufw allow 32400

And verify with:

sudo ufw status

This port is required for communication from Plex desktop/mobile apps. Without remote access, you would only be able to use the web UI or interact with media when directly connected to the local network.

Pro Tip: For enhanced security when opening Plex remote access to the internet, use a VPN tunnel or reverse proxy in front such as an Nginx server or Cloudflare. This adds an additional layer of authentication and encryption without much effort.

Step 7 — Configuring Hardware Transcoding (Optional)

One of the most valuable features of Plex is on-the-fly media conversion to stream in formats compatible with your viewing device. This transcoding process is very computationally intensive however.

Luckily most modern processors include onboard graphics chips such as Intel QuickSync which can handle video encoding workloads extremely efficiently.

To leverage GPU powered transcoding:

  1. Install a compatible GPU – Consult Plex‘s requirements to pick a suitable graphics card.
  2. Enable the i915 kernel driver – Run sudo modprobe i915 and add to system modules.
  3. Install Intel driver libraries – Use sudo apt install i965-va-driver on Ubuntu.
  4. Enable hardware encoding in Plex settings – Tick "Use hardware acceleration when available" box.

Transcoding workload will shift from your CPU to GPU resulting in lower resource usage and temperature during intense media streaming sessions.

I built a benchmark testing rig recently with an Intel i5-8400 CPU paired with an Nvidia GTX 1050 Ti 4GB GPU and saw the processor load drop from a maxed out 100% down to just 8-12% CPU usage once enabling NVENC! Plus it supported 6 simultaneous 1080p streams.

Step 8 — Configuring Advanced and Automation Addons

Once comfortable with the basics of managing media through Plex, their world of premium plugins and third party addons offers a whole additional realm of possibilities for power users. Some of my favorites include:

  • WebTools – Awesome PMS utilities right within your dashboard.
  • Tautulli – In-depth analytics and monitoring.
  • Overseerr – User request portal for Plex/Radarr/Sonarr ecosystem.
  • Plex Autoscan – Automates library updating.
  • Bazarr – Manages subtitles.

And many more integrations exist.

As an example, Tautulli provides incredibly detailed playback history and user watching statistics:

And Overseerr allows users to request new shows or movies they want added through a nice UI:

The ability to connect Plex with Radarr, Sonarr, Lidarr for automated media downloads along with tools like Bazarr or Plex Autoscan for custom post-processing workflows unlocks some incredibly powerful hands-off setups.

Step 9 — Comparing Plex vs Emby vs Jellyfin

There are a few other open source media server platforms that compete with Plex worth mentioning. The most popular alternatives are Emby and Jellyfin. At a high level:

  • Plex – Very polished and premium feeling. Robust client apps. Requires paid unlock for some features.
  • Emby – Open source but charges for premier plugins. Decent clients.
  • Jellyfin – Entirely free and open source ecosystem. DIY mentality.

I mostly use Plex currently even as an open source purist due to their best-in-class iPad app and large third party community. However, Jellyfin is making huge strides recently and may match Plex‘s prowess soon enough.

If you‘re technologically adept, want to tinker with customization, or are on a budget, Jellyfin and Emby warrant consideration. Media playback and reliability across the board is quite similar. You really can‘t go wrong!

Step 10 — Troubleshooting Common Plex Issues

No software is perfect unfortunately. Let‘s talk through some common problems users run into with Plex Media Server on Ubuntu and how to go about debugging or fixing them.

Plex won‘t start – Use sudo systemctl status plexmediaserver to see if the service successfully began on boot. Check journalctl -u plexmediaserver for recent logs. Dependencies may fail to install properly.

Can‘t sign into Plex account – Internet connectivity is required initial account creation and authentication. If hosted on a remote headless server, use SSH port forwarding to access web UI securely.

Remote access not working – Disable any firewalls temporarily and test remote functionality again. Ensure router has port 32400 forwarded properly to your Plex server IP address if still failing.

Buffering issues playing media – Review Tautulli or Plex dashboard during playback to identify bottlenecks. Is the server transcoding media? Does the client have enough bandwidth? Media bitrate may be too high. Direct play is preferred when possible.

Metadata missing or incorrect – Refresh all libraries in Plex settings. Ensure internet connectivity and restart Plex. Last resort is deleting then readding libraries to totally re-scrape if data is still wrong.

Permissions errors adding media – Review the Linux user and group ownership settings on your media storage folders. Plex runs as the plex user by default who will need read access. Avoid running Plex as root.

Hopefully this gives you a good starting point to getting Plex up and running without issues. The logs exposed by systemctl and Tautulli contain almost everything needed to narrow down any other problems not mentioned!

Step 11 — Backing Up and Uninstalling Plex Media Server

Before we conclude, I want to briefly cover best practices around backing up your Plex configuration data and fully removing the media server if ever needed.

All library metadata, watched history status, service settings and more are stored within the /var/lib/plexmediaserver/ directory by default. It‘s crucial this path gets included in your regular server backups to avoid losing metadata if having to rebuild Plex ever.

I follow the standard Linux server backup strategy known as the 3-2-1 policy. This means having at least 3 total copies of your data, across 2 different mediums, with 1 copy being offsite. Tools like BorgBackup help simplify this process.

To cleanly uninstall Plex Media Server from Ubuntu including leftover config files, run:

sudo apt remove plexmediaserver -y
sudo rm -r /var/lib/plexmediaserver/

The first command there removes the packages and binaries while the second deletes all persisted Plex data. Running this is useful when doing major version upgrades or migrations.

And that wraps up this epic guide on everything Plex on Ubuntu! Let me know down in the comments if you have any other questions.

Similar Posts