How to Install Plex Server on Ubuntu

e commerce 1606962 640

This brief tutorial shows students and new users how to install Plex Media Server on Ubuntu 20.04 | 18.04.

Plex is a media server that allows you to create and organize all your personal video, music and photo collections and stream them to your mobile devices, TV and computer from anywhere. 

It has two main components: Plex Media Server and a client application that runs on Windows, macOS and Linux and almost all mobile devices.

In most environments, Plex server is installed on a computer that has a lot of storage space or has a NAS attached to it to store and access a large collections of variety or media.

If you’re a student or a new user looking for an easy tutorial to guide you installing and using Plex, this post should come in handy.

When you’re ready to install Plex Media Server, follow the steps below:

Install Plex Media Server

Plex is proprietary software, and it is not included in the Ubuntu default repositories. If you need to install Plex in Ubuntu, you will have to manually download or add its repository.

To add Plex’s repository to Ubuntu, use the commands below to add its APT repository and import the GPG key for the repository.

wget -q https://downloads.plex.tv/plex-keys/PlexSign.key -O - | sudo apt-key add -
sudo sh -c 'echo "deb https://downloads.plex.tv/repo/deb/ public main $(lsb_release -sc) contrib" >> /etc/apt/sources.list.d/plexmediaserver.list'

Once the APT repository and key are added above, run the commands below to update Ubuntu APT package list and install Plax Media Server.

sudo apt update
sudo apt install plexmediaserver

To check and validate that Plex is installed, run the commands below.

sudo systemctl status plexmediaserver

You should see its status info as shown below:

● plexmediaserver.service - Plex Media Server
     Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2021-06-25 09:45:58 CDT; 1min 36s ago
    Process: 4060 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_APPLICATION_SUPPO>
   Main PID: 4062 (Plex Media Serv)
      Tasks: 109 (limit: 4652)
     Memory: 219.1M
     CGroup: /system.slice/plexmediaserver.service
             ├─4062 /usr/lib/plexmediaserver/Plex Media Server

Also, the commands below can be used to stop, start and enable Plex media server.

sudo systemctl stop plexmediaserver
sudo systemctl start plexmediaserver
sudo systemctl enable plexmediaserer

Adjusting Ubuntu Firewall

If you have Ubuntu firewall enabled, you will want to adjust the firewall rules to allow Plex server to be accessed remotely.

The easiest way to adjust Ubuntu firewall to allow traffic to Plex server is to create a firewall profile for Plex server. To do that, run the commands below to create a UFW Plex server profile.

sudo nano /etc/ufw/applications.d/plexmediaserver

The copy the lines below and paste into the file and save.

[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 exit.

Update the firewall profile and apply the new rules.

sudo ufw app update plexmediaserver
sudo ufw allow plexmediaserver-all

Now you can check the firewall rules to see if traffic are being passed to the Plex server.

sudo ufw status verbose

That should output similar lines as shown below:

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

To                         Action      From
--                         ------      ----
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                              

Now go and create Plex catalog directory to store its content. For this post, we’re creating Plex’s folder in the /opt/plexmedia directory.

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

The give Plex users access to the directory.

sudo chown -R plex: /opt/plexmedia

Access Plex Web Portal

Now that Plex is installed, open your browser and browse to its portal. You can use the portal to manage your media and other settings.

http://localhost:32400/web/

That should open its portal page.

plex server on ubuntu install

Create an account and login. Of use Facebook or other authentication methods. However, for Plex to work well, you should create and account.

Continue with the setup wizard.

plex server ubuntu install

Make sure to check the box to allow Plex to be accessed outside of your home. Plex will attempt to automatically configure your network to allow Plex apps outside your home to access Plex Media Server on this computer. Remember this computer will need to be turned on to access your media.

On the browse for media folder, make sure to select the path created above: /opt/plexmedia/movies.

When you’re done with the setup wizard, go and begin enjoying your media content.

plex media server dashboard on ubuntu

Updating Plex Server

When newer versions of Plex server are available, simply run the commands below to update.

sudo apt update
sudo apt install --only-upgrade plexmediaserver

Conclusion:

This post showed you how to install and configure Plex Media Server on Ubuntu. If you find any error above, please use the comment form below to report.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.