Plex is a self-hosted streaming media server that organizes your video, music, and photo collections into a polished media library and streams them to phones, tablets, smart TVs, game consoles, and web browsers. You manage everything from one web interface and watch from any device, anywhere.
The recommended method on Ubuntu 18.04 is the official Plex APT repository. Using the repository rather than a manually downloaded .deb file means future Plex updates arrive automatically through the standard Ubuntu package manager. The same steps apply to Debian and Ubuntu 16.04.
<strong>Prerequisite:</strong> You need sudo access.
Import the Plex GPG signing key. This authenticates packages from the Plex repository and blocks installation of tampered packages:
bashcurl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
Add the Plex APT repository:
bashecho deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
Install Plex Media Server:
bashsudo apt install apt-transport-httpssudo apt updatesudo apt install plexmediaserver
apt-transport-https is required because the Plex repository is served over HTTPS. Without it, apt cannot fetch packages from that source.
The Plex service starts automatically after installation. Verify it is running:
bashsudo systemctl status plexmediaserver
The output should show Active: active (running). Plex runs as a dedicated plex system user, which isolates the process and limits what it can access on the rest of your server.
Plex uses multiple ports for different functions. Creating a custom UFW application profile groups all of them so you can open or close them with a single command.
Create the profile at /etc/ufw/applications.d/plexmediaserver with three sections:
DLNA lets supported devices like Samsung smart TVs and PlayStation consoles discover and play your Plex media without the Plex app installed. Skip the DLNA section if you only stream through the Plex app.
Update the profiles list and apply the combined firewall rule:
bashsudo ufw app update plexmediaserversudo ufw allow plexmediaserver-allsudo ufw status verbose
Create the directories for your media files and set ownership for the Plex service user:
bashsudo mkdir -p /opt/plexmedia/{movies,series}sudo chown -R plex: /opt/plexmedia Plex runs as the plex system user. The chown -R plex: command sets both user and group ownership on the directories. Without this step, Plex cannot read or index any files you place there.
Open http://YOUR_SERVER_IP:32400/web in a browser. The setup wizard loads. Sign in or create a free Plex account using Google, Facebook, or email.
Plex Pass is an optional subscription that adds hardware-accelerated transcoding, offline sync, live TV and DVR support, and mobile downloads. The free account covers everything you need for standard home streaming.
After signing in, name your server and click Add Library. Choose the library type (Movies, TV Shows, Music, or Photos), browse to the media folder you created, and confirm. Plex scans the folder and pulls in metadata including posters, descriptions, and ratings from online databases automatically. Add a separate library for each content type you store.
Once setup completes, install the Plex app on your phone, tablet, Smart TV, Roku, Xbox, or Chromecast. Sign in with the same Plex account and start streaming from any device.
To keep Plex updated:
bashsudo apt updatesudo apt upgrade
The Plex APT repository you registered during installation delivers updates alongside your other system packages.
Plex Media Server is now installed, secured, and configured on Ubuntu 18.04. Add your media files to the library directories, trigger a scan, and start watching from anywhere. Leave a comment below if you run into any issues.
Nextcloud is a free, open-source, self-hosted file sharing and collaboration platform. It gives you a private…
Visual Studio Code is a free, open-source, cross-platform code editor from Microsoft. It ships with built-in…
Odoo is one of the most widely used open-source ERP platforms in the world. It handles…
Let's Encrypt is a free, automated, and open certificate authority run by the Internet Security Research…
Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server and reverse proxy. It handles…
Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server and reverse proxy. It handles…