Plex is a powerful streaming media server that provides a seamless way to organize and access your video, music, and photo collections. With Plex, you can effortlessly stream your media content to various devices such as computers, smartphones, tablets, and TVs, regardless of your location. It supports installation on a wide range of operating systems and devices, making it a versatile solution for media streaming and management.

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

Installing Plex Media Server on Ubuntu

Plex, being proprietary software, is not available in the Ubuntu repositories by default.

To install Plex Media Server on Ubuntu, you can follow a simple and straightforward process. By enabling the official Plex repository and utilizing the apt package manager, you can quickly install and configure the media server without requiring extensive technical expertise. The installation and setup should take no longer than 20 minutes.

Begin by adding the Plex APT repository to your system and importing the repository’s GPG key using the following steps:

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

Once the repository is enabled, update the apt package list and install the latest server version:

sudo apt update
sudo apt install plexmediaserver

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’re utilizing UFW (Uncomplicated Firewall) to manage your firewall settings, creating a UFW application profile is a convenient way to allow access to Plex-specific ports. By creating this profile, you can easily enable or disable the necessary firewall rules for Plex.

To create a UFW application profile for Plex, follow these steps:

Open your terminal and run the following command to create a new UFW application profile for Plex:

bashCopy codesudo nano /etc/ufw/applications.d/plexmediaserver

Inside the text editor, add the following content to the file:

makefileCopy code[PlexMediaServer]
title=Plex Media Server
description=Plex Media Server application profile
ports=32400/tcp|1900/udp

Save the file and exit the text editor.

Now, enable the new Plex application profile by running the following command:

Copy codesudo ufw allow 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 executed 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 web browser and enter the following address: http://YOUR_SERVER_IP:32400/web. This will redirect you to the Plex website, where you can begin setting up and configuring your Plex Media Server.

To ensure the proper functionality of Plex, it is necessary to create an account. Simply click on the Google, Facebook, Apple, or Email button to register for a free Plex account. If you desire access to premium features, you can consider purchasing a Plex Pass plan.

Upon successful registration, you will be directed to a page containing information about Plex and its workings, as depicted in the following image:

After clicking the “Got it” button, you will be directed to the next screen. Here, provide a name for your Plex server, ensure that the “Allow me to access my media outside my home” option is selected, and proceed by clicking on the “Next” button.

After completing the previous steps, the next task is to add a media library. Locate and click on the “Add Library” button.

In the popup window that appears, select “Movies” as the library type, and then click on the “Next” button to proceed.

In the next step, click on the “Browse for media folder” button. Then, add the path to the directory that will contain the Movies media files. In this case, the path is /opt/plexmedia/movies.

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

You can add as many Libraries as you want.

Click Next, then Done, and you will be redirected to the Plex web 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 update
sudo 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.

Comments to: How to Install Plex Media Server on Ubuntu 20.04

    Your email address will not be published. Required fields are marked *