How to Install Plex Media Server on Ubuntu 20.04

Published on

5 min read

Install Plex Media Server on Ubuntu 20.04

Plex is a streaming media server that lets you organize your video, music, and photo collections and stream your media to your computer, phone, tablet, or TV at any time and from anywhere. Plex media server can be installed on all major operating systems and devices.

This article explains how to install Plex Media Server on Ubuntu 20.04.

Installing Plex Media Server on Ubuntu

Plex is proprietary computer software, and it is not included in the Ubuntu repositories.

Installing Steam on Plex Media Server is fairly straightforward. We’ll enable the Plex official repository and install the package with apt . It requires no technical knowledge, and it should not take you more than 20 minutes to install and configure the media server.

  1. Add the Plex APT repository to your system and import the repository’s GPG key:

    curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
  2. Once the repository is enabled, update the apt package list and install the latest server version:

    sudo apt updatesudo apt install plexmediaserver
  3. To verify that the Plex is running, check the service status:

    sudo systemctl status plexmediaserver

    The output should look something like this:

    ● plexmediaserver.service - Plex Media Server
        Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
        Active: active (running) since Thu 2021-06-17 19:36:33 UTC; 23min ago

That’s it. At this point, you have a Plex media server installed on your Ubuntu machine.

Adjusting the Firewall

Now that Plex is installed and running on your server, you need to make sure the server firewall is configured to allow traffic on the Plex-specific ports.

If you do not have a firewall running on your system, skip this section.

If you are using UFW to manage your firewall, the easiest option is to create a UFW application profile:

sudo nano /etc/ufw/applications.d/plexmediaserver
/etc/ufw/applications.d/plexmediaserver
[plexmediaserver]
title=Plex Media Server (Standard)
description=The Plex Media Server
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp

[plexmediaserver-dlna]
title=Plex Media Server (DLNA)
description=The Plex Media Server (additional DLNA capability only)
ports=1900/udp|32469/tcp

[plexmediaserver-all]
title=Plex Media Server (Standard + DLNA)
description=The Plex Media Server (with additional DLNA capability)
ports=32400/tcp|3005/tcp|5353/udp|8324/tcp|32410:32414/udp|1900/udp|32469/tcp

Save the file and update profiles list:

sudo ufw app update plexmediaserver

Apply the new firewall rules:

sudo ufw allow plexmediaserver-all

Finally, check if the new firewall rules are applied successfully with:

sudo ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW IN    Anywhere
32400/tcp (plexmediaserver-all) ALLOW IN    Anywhere
3005/tcp (plexmediaserver-all) ALLOW IN    Anywhere
5353/udp (plexmediaserver-all) ALLOW IN    Anywhere
8324/tcp (plexmediaserver-all) ALLOW IN    Anywhere
32410:32414/udp (plexmediaserver-all) ALLOW IN    Anywhere
1900/udp (plexmediaserver-all) ALLOW IN    Anywhere
32469/tcp (plexmediaserver-all) ALLOW IN    Anywhere

Configuring Plex Media Server

Before starting the Plex setup wizard, you can first create the directories that will store the Plex media files:

sudo mkdir -p /opt/plexmedia/{movies,series}

The Plex Media Server runs as the user plex, which must have read and execute permissions to the media files and directories. To set the correct ownership , enter the following command:

sudo chown -R plex: /opt/plexmedia
You can choose any location to store the media files; just make sure you set the correct permissions.

You can now proceed with the server configuration. Open your browser, type http://YOUR_SERVER_IP:32400/web, and you will be redirected to the plex website.

Plex Media Server Sign In

For Plex to work properly, you will need to create an account.

Press the Google, Facebook, Apple, or Email button to create a free Plex account. If you want to access premium features, purchase a Plex Pass plan.

Once you sign up, you will be redirected to the page with information about how Plex works, as shown below:

How Plex Works

Click on the Got it button.

On the next screen, enter your Plex server name, leave the Allow me to access my media outside my home box checked, and click Next.

Plex Server Setup Hostname

The next step is to add a media library. Click on the Add Library button.

When the popup window shows, select movies as library type and click Next.

Plex Media Server Add Library

In the next step, click on the Browse for media folder and add the path to the directory that will contain the Movies media files, in our case /opt/plexmedia/movies.

Plex Media Server Movies Folder

Click on the Add button and then on the Add Library.

You can add as many Libraries as you want.

Plex Media Library

Click Next, then Done, and you will be redirected to the Plex web dashboard.

Plex Media Server Dashboard

Now that you have completed the setup wizard, you can start exploring Plex options and all the things it can do.

Updating Plex Media Server

When a new version is released, to update Plex, run the following commands in your terminal:

sudo apt updatesudo apt install --only-upgrade plexmediaserver

During the installation process, the official Plex repository may be disabled. To enable the repository, open the plexmediaserver.list file and uncomment the line starting with “deb”:

sudo nano /etc/apt/sources.list.d/plexmediaserver.list
# When enabling this repo please remember to add the PlexPublic.Key into the apt setup.
# wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add -
deb https://downloads.plex.tv/repo/deb/ public main

Conclusion

We have shown you how to install Plex Media Server on your Ubuntu 20.04 machine and create a Media Library.

You can now install the Plex application on your Android, iPhone, Smart TV, Xbox, Roku, or any other supported device. You can find a list of supported Apps & Devices on the Plex Downloads page, or you can simply install the application from the device’s app store.

You should also check out the official Plex Quick-Start guide and Plex Documentation page.

If you have any questions, please leave a comment below.