Plex is a streaming media server. It is cross-platform and can be installed on all major operating systems. With the help of the Plex streaming media server, you can organize your music, videos, and photo collection. You can also stream your media to your devices like computers, phones, tv from anywhere with the help of a Plex media server.
In this tutorial post, we will show you the methods for installing the Plex media server on Ubuntu 20.04.
Install Plex Media Server On Ubuntu 20.04
Plex is not included in the Ubuntu repositories. Run the following commands:
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
Now, update the apt package list and install the latest Plex media server with the help of the following command:
sudo apt update
sudo apt install plexmediaserver
After installing, run the following command to make sure that the Plex is running:
sudo systemctl status plexmediaserver
The output should look something like the below:
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2021-12-18 15:25:48 UTC; 13min ago
Now, you need to make sure the server firewall is allowing the traffic on the Plex-specific port.
For UFW users, the easiest option is to create a UFW application profile. For this, run the following command:
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
Now, You need to save the file and update the profiles list:
sudo ufw app update plexmediaserver
Run the following commands to apply the new firewall rules:
sudo ufw allow plexmediaserver-all
Just to make sure that the new firewall rules are applied successfully:
sudo ufw status verbose
You will output something like below:
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
Now we need to create the directories so that we can store the Plex media files:
sudo mkdir -p /opt/plexmedia/{movies,series}
There will be the user plex to run the Plex Media Server and that should have read and execute permissions to the media files and directories.
sudo chown -R plex: /opt/plexmedia
Now, open your favorite browser and run http://SERVER_IP:32400/web
, and follow the onscreen instructions.