Introduction
Plex has become the hottest media server software that lets you host your personal media collections, including videos, music, photos, online news and podcasts in a beautiful unified interface accessible from all your devices. With Plex, you can forget about needing separate apps to manage each media type – it brings everything together in one place allowing you to consume content how and when you want.
In this comprehensive guide, we will go through step-by-step process to get latest version of Plex Media Server installed and configured on a Ubuntu 22.04 system. We will also cover some tips, best practices, optimizations and troubleshooting to help you get the most out of your Plex server.
Why Use Plex?
Before we jump into the installation, it‘s worth understanding what makes Plex so popular. Here are some of its standout features:
Stream Any Personal Media – Plex can play video, audio and photos from your local storage. So all those movies, TV shows, home videos, music and photos can now be streamed to any device no matter where you are.
Automatic Organization – Plex leverages metadata and algorithms to automatically identify and organize your media collections so you don‘t need to manually tag or categorize anything.
Intuitive Interface – The interface makes browsing through your libraries feel natural and shows personalized recommendations based on your viewing history.
Top Hardware Support – Plex takes advantage of hardware transcoding to allow streaming high quality content without needing high powered clients. It supports Intel QuickSync and NVIDIA GPUs for efficient transcoding.
Available Across All Devices – Plex client apps allow access on mobiles, smart TVs, streaming boxes, gaming consoles, PCs and more. This makes your media available anytime, anywhere.
Sharing Capabilities – You can securely share libraries and collections with friends and family to give them access to your Plex server. Useful for sharing home videos and photos.
With its versatile media management capabilities and multi device access, it‘s no wonder Plex has become so hugely popular among home media enthusiasts.
Now let‘s look at recommended server hardware…
Plex Server Hardware Considerations
Plex Media Server can run on modest hardware, but for best performance especially when transcoding video streams, we recommend having:
- A modern multi-core processor – Intel Core i5 equivalent or better. More cores will help with parallel transcoding.
- 8GB RAM at the minimum for optimal transcoding capabilities. 16GB recommended for larger libraries.
- Discrete NVIDIA GPU for hardware accelerated video encoding using NVENC. GTX 1050 or better equivalent.
- Gigabit ethernet connectivity for wired local streaming.
- AC wireless connectivity for streaming over WiFi.
- Enough local storage in a RAID config for redundancy – aim for at least 10 TB+. Bays for future expansion.
Ideally get a server chassis that can accommodate multiple hard drives. Other optimizations like SSD caches can boost performance when serving a lot of random media file access over the network.
With the hardware covered, let‘s move on to the software installation process…
Step 1 – Update Ubuntu 22.04
Log into your Ubuntu 22.04 server and first update the package lists to ensures we get the latest package versions:
sudo apt update
sudo apt upgrade
This fetches latest packages from enabled repositories and installs available updates.
Step 2 – Install Prerequisite Packages
Plex requires some additional dependencies available in Ubuntu repositories. Install them with:
sudo apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common -y
Here apt-transport-https
adds support for repositories accessed over HTTPS. ca-certificates
provides root certificates for verifying signed packages. curl
and gnupg2
will be used to authorize the Plex repository. Finally, software-properties-common
enables us to manage PPA repositories.
Step 3 – Authorize Plex Repository
Next we‘ll authorize the official Plex repository by importing the GPG key to confirm packages are signed by Plex:
curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo gpg --dearmor -o /usr/share/keyrings/plex.gpg
And add the repo details to sources list:
echo deb [signed-by=/usr/share/keyrings/plex.gpg arch=amd64] https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
This will allow installing the Plex server directly from the repo.
Step 4 – Install Plex Media Server
With the repository configured, install the plexmediaserver
package:
sudo apt update
sudo apt install plexmediaserver -y
This will install latest Plex Media Server version available in the repository.
Once installed various Plex services will start automatically. We can check their status with:
systemctl status plexmediaserver
Sample output:
● plexmediaserver.service - Plex Media Server for Linux
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-12-30 18:21:44 UTC; 47min ago
Docs: https://support.plex.tv/
Main PID: 987 (plexmediaserver)
Tasks: 46 (limit: 9436)
CPU: 174.ifa26964s
CGroup: /system.slice/plexmediaserver.service
└─987 /usr/lib/plexmediaserver/Plex\x20Media\x20Server
This confirms the Plex Media Server service is active and running.
Step 5 – Adjust Firewall Rules
If using ufw
firewall, allow the plex ports by:
sudo ufw allow 32400
This opens TCP port 32400 that‘s used for accessing the Plex Media Server web app and communicating with Plex client devices.
We also recommend opening the UDP port 1900 used for service discovery:
sudo ufw allow 1900/udp
Check current firewall rules with:
sudo ufw status
Step 6 – Accessing Plex Web App
With Plex server installed and running, you can now access the Plex Web App by going to:
http://<server-ip>:32400/web
Simply replace <server-ip>
with your Ubuntu server‘s IP address or hostname.
On the first run, you‘ll be prompted to sign up and create a Plex account which is free. This account will be the Plex Server admin so remember login credentials.
The Plex web app provides options to manage your media libraries, adjust server settings, mange user accounts and access clients.
And that covers the basic installation! Now let‘s talk about optimizing our server setup further…
Advanced Configurations
Plex runs great out of the box but we can tweak couple of things to take it to the next level.
Enable Hardware Transcoding
One of the biggest values Plex provides is on-the-fly media transcoding. This allows content to be converted to a format your client device can play.
However transcoding can be CPU intensive. Instead we can offload it to the GPU for streamlined performance leveraging hardware acceleration interfaces like:
- Intel Quick Sync Video (QSV)
- NVIDIA NVENC
To enable hardware acceleration, edit the Plex config file:
sudo nano /usr/lib/plexmediaserver/Resources/Preferences.xml
Uncomment related lines:
<Transcoder>
<Decode>
<HWRole>auto</HWRole>
<HWAcceleration>true</HWAcceleration>
</Decode>
<Encode>
<HWRole>auto</HWRole>
<HWAcceleration>true</HWAcceleration>
</Encode>
</Transcoder>
Tune Transcoder Settings
We can also optimize transcoder performance to maximize parallel streams.
Recommended settings for 3-4 simultaneous 1080p transcodes:
<TranscodeTarget>3</TranscodeTarget>
<GPUAcceleration>true</GPUAcceleration>
<MaxVideoBitrate>12000</MaxVideoBitrate>
<MaxAudioChannels>6</MaxAudioChannels>
Save changes and restart Plex to apply new config.
For more tuning tips, check Plex‘s guidance.
Prefer Dedicated GPU
When having multiple GPUs, we can pick which GPU Plex uses for hardware encoding:
sudo nano /etc/default/plexmediaserver
And specify the preferred device ID:
PLEX_MEDIA_SERVER_EXTRA_ARGS="--runtime-option videotoolbox-decoder-device=/dev/dri/card1"
Where card1
is the ID of GPU you want Plex to use.
Installing Plex in Docker
An alternative to bare metal installation is running Plex Media Server in a Docker container.
Docker provides predictable and reproducible environments, simplified dependencies as well flexible orchestration. This allows effortless management, scaling and updates.
Here is a sample Docker compose file to run Plex:
---
version: ‘2‘
services:
plex:
image: linuxserver/plex
container_name: plex
network_mode: host
environment:
- PUID=1000
- PGID=1000
- VERSION=docker
volumes:
- /path/to/library:/config
- /path/to/tvseries:/tv
- /path/to/movies:/movies
restart: unless-stopped
This maps dedicated media folders from the Docker host to the container providing library persistence. And network_mode: host
allows direct access to Plex web app on port 32400 without any port forwarding.
With Docker, you don‘t need to worry about installing dependencies or configuring hardware acceleration. The linuxserver containers come pre-tuned for optimal use.
Client Access and Remote Streaming
Once up and running, there are couple ways to access your Plex libraries:
Web App – Convenient access directly from browser at http://server:32400/web
Plex Clients – Apps across mobiles, smart TVs, consoles, etc. Discover local server automatically using UPnP or sign in to remote access
Remote Access – Makes server accessible over internet by enabling under server settings > Remote Access
This configures port forwarding rules on your router for external connectivity. You can also manually setup forwarding to expose default port 32400.
Secure connections are enabled by default allowing encrypted access to shield your precious media.
Adding Media Libraries
The fun part about Plex is finally adding all your media to create beautiful libraries that get automatically categorized!
Use the Plex web interface to manage libraries under settings icon > Manage > Libraries.
Libraries can point to local storage folders on server itself or mounted network storage like a NAS. Make sure Plex process has access permissions to your media folders.
Plex will automatically group media, download rich metadata like descriptions, posters and backgrounds as well as fetch subtitles. Very little manual intervention needed!
Users and Sharing
A Plex server owner can invite other users to share access to hosted libraries and personal media collections.
Create managed user accounts under Settings > Manage > Users menu of the web app. You can then choose which libraries get shared.
Granular restrictions can be enforced like only allowing streaming on home network or limiting video qualities. Make sure invite privileged users judiciously.
Securing Your Server
When exposing Plex to external networks or untrusted users, it becomes vital to lock things down. Some tips:
Firewall Rules – Only open ports 80, 443, 32400 TCP & 1900 UDP using UFW
User Access – Disable guest access and enforce user sign in for authentication
HTTPS – Require encrypted connections for all remote access
Token Auth – Revoke old tokens and enable token authentication under settings
Secure Sharing – Disable insecure connections when sharing server with untrusted users
Subnets – Restrict server access to only your home subnet or private IP ranges
Plex also maintains comprehensive security guidance for further hardening.
Plex Integrations
The Plex ecosystem offers seamless integration with popular software solutions to take your media workflows to next level:
Tautulli – Robust realtime monitoring and analytics for Plex usage and streams
Sonarr – Automated TV shows downloading and management
Radarr – Automated movie downloader and library manager
Ombi – User request portal for Plex content
Trakt – Scrobble watched content and sync watching progress across devices
Check out Tautulli dashboard and Ombi request system integrations in action:
These optional softwares connect with Plex API to provide helper functionality that enriches the overall experience.
Troubleshooting Common Issues
Plex is generally very stable during everyday operation. But should things go wrong, here are some commonly encountered problems and their fixes:
Can‘t sign in to Plex Web – Try restarting browser, clearing cache/cookies or using incognito mode.
Subtitle issues – Disable direct play for problematic media or optimizing subtitle encoding.
Buffering problems – Check network bandwidth and WiFi coverage. Lower client streaming quality as needed in app settings.
Choppy video – Enable media transcoding in playback settings if your client can‘t direct play media.
No hardware encoding – Confirm GPU driver installed properly and permissions to device files are correct.
Remote access not working – Could be double NAT issue or remote access capability not enabled in server settings.
Firewall blocking access – Remember opening TCP port 32400. Adding UDP 1900 port also helps discovery.
Don‘t hesitate to consult Plex‘s exceptional support documentation for more troubleshooting.
Closing Thoughts
After going through this extensive guide, you should now have a fully functioning Plex server on Ubuntu ready to manage and stream all your personal media!
We looked at optimizing performance, enabling hardware transcoding, remote access options as well as neat complementary softwares. But this just scratches the surface of what‘s possible.
There is still auto downloading of TV shows & movies and tools to carefully monitor server analytics. You can enable live TV with OTA tuners along with DVR capabilities to record shows. Or go hardcore by setting up RAID storage pools and scheduled local & cloud backups. The possibilities are endless!
Hopefully this gave you a solid foundational setup to start your home media center journey with Plex. Build up those libraries and happy streaming!