How to Install Plex Media Server on Ubuntu

  1. Install Plex on Ubuntu From Plex Official Repository
  2. Configure Firewall for Plex Media Server
  3. Configure Plex Media Server

Plex is a media streaming software that allows us to organize media files and stream those media contents anytime we wish. We can install the Plex Media Server from the Plex official repository.

Install Plex on Ubuntu From Plex Official Repository

  • Import the repo’s GPG using the command:
    curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add -
    
  • List the Plex’s repository in our sources list using the command
    echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
    
  • Install the package apt-transport-https using the command:
    sudo apt install apt-transport-https
    
  • Update the package sources using the command:
    sudo apt update
    
  • Install the Plex package using the command:
    sudo apt install plexmediaserver
    

We can check whether the Plex Media Server is installed or not using the command:

sudo systemctl status plexmediaserver

If the Plex Media Server is installed we will get the output as:

● plexmediaserver.service - Plex Media Server
   Loaded: loaded (/lib/systemd/system/plexmediaserver.service; enabled; vendor 
   Active: active (running) since Wed 2020-10-07 18:01:06 +0545; 2min 5s ago
  Process: 15357 ExecStartPre=/bin/sh -c /usr/bin/test -d "${PLEX_MEDIA_SERVER_A
 Main PID: 15361 (Plex Media Serv)
    Tasks: 111 (limit: 4915)
   CGroup: /system.slice/plexmediaserver.service

Configure Firewall for Plex Media Server

Once the installation is verified, we need to configure the firewall, which will allow traffic on specified ports of the Plex media server. To configure the firewall, we perform the following steps:

  • ##### Create a UFW application profile at the location /etc/ufw/applications.d/plexmediaserver with the content using any editor: ```bash [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


- ##### Update the list of profiles using the command:
```bash
sudo ufw app update plexmediaserver
  • ##### Configure new rules for the firewall using the command: bash sudo ufw allow plexmediaserver-all

To verify whether the rules are configured or not, we use the command:

sudo ufw status verbose

If the configuration is successful, we get the following output:

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

Configure Plex Media Server

Now, we create a directory to hold the contents in Plex with the following command:

sudo mkdir -p /opt/plexmedia/<content-folder-name>

After this, we set the permission for plex user to access the content files with the following command:

sudo chown -R plex: /opt/plexmedia

Now we can go to http://server_ip:32400/web and sign in to the plex account and continue.a

comments powered by Disqus