How To

Install Plex Media Server on Ubuntu 18.04: Step-by-Step Setup

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>&nbsp;You need sudo access.

Install Plex Media Server on Ubuntu via the Official Repository

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.

Configure UFW Firewall Rules for Plex Media 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:

  • plexmediaserver (standard): the main web interface (32400/tcp), companion app port (3005/tcp), mDNS discovery (5353/udp), Roku control (8324/tcp), and network sync (32410 to 32414/udp)
  • plexmediaserver-dlna: the DLNA ports (1900/udp and 32469/tcp) for Smart TVs and game consoles that support native DLNA media playback
  • plexmediaserver-all: both groups combined

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

Set Up Media Directories and Run the Plex Setup Wizard

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.

Cyber Defence

Recent Posts

Install Nextcloud on Ubuntu 18.04 with Apache and MySQL

Nextcloud is a free, open-source, self-hosted file sharing and collaboration platform. It gives you a private…

44 minutes ago

Install Visual Studio Code on Ubuntu 18.04: Microsoft Repo Setup

Visual Studio Code is a free, open-source, cross-platform code editor from Microsoft. It ships with built-in…

54 minutes ago

Install Odoo 11 on Ubuntu 16.04 with Git and Python Virtualenv

Odoo is one of the most widely used open-source ERP platforms in the world. It handles…

59 minutes ago

Secure Nginx with Let’s Encrypt on Ubuntu 16.04: SSL Setup Guide

Let's Encrypt is a free, automated, and open certificate authority run by the Internet Security Research…

1 hour ago

Install Nginx on Ubuntu 16.04: UFW, PPA, and Config Structure

Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server and reverse proxy. It handles…

1 day ago

Install Nginx on Ubuntu 18.04: UFW, Service Control, and Config

Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server and reverse proxy. It handles…

1 day ago