Setting up Plex on Ubuntu for Media Storage

Published November 30, 2023

Decoding Plex

Plex is a versatile media server and streaming platform that allows users to store, play, and manage their media content, including music, movies, photos, TV shows, and more.

If you’re a fan of movies and TV shows, Plex is an ideal solution for accessing and organizing your digital media content.

With its sleek user interface, Plex displays all your media content, including movies and photos, and allows you to share your movie collections with others.

Unlike other video streaming services, Plex software enables you to stream your movie and video collections to other devices.

Additionally ,Plex is compatible with all popular operating systems, including Linux-based operating systems like Ubuntu, making it easy to install and use the Plex Media on Ubuntu.

The Benefits of Running Plex on Ubuntu!

Embrace Plex with Confidence on Ubuntu Linux: Unveiling the Features and Advantages Awaiting You!

  • It helps you manage and organize your media libraries for watching and accessing movies, TV shows, and music. This makes browsing and searching your media content quicker and easier.
  • It allows you to stream your media content to various devices, such as smart TVs, smartphones, gaming consoles, and web browsers and enables access to your media from anywhere with an internet connection.
  • It can transcode media, allowing you to adjust the quality of media streaming according to the capabilities of your playback device and creating a smooth playback experience on different devices.
  • You can access your media server remotely, which is useful when you’re not at home and want to access your media content or you want to share your libraries with friends and family securely.
  • It the creation of multiple user profiles with different levels of access.
  • With its security features, preserves your privacy and protects your media content and data.
  • You can watch and even record live TV shows and configure DVR and live TV functionalities.
  • It provides media synchronization for offline watching with mobile devices, ensuring that media content is accessible without an internet connection in any situation.
  • It supports a variety of plugins and add-ons to expand its functionality, such as subtitles, parental controls, and more.
  • It is a self-hosted solution that eliminates the need for third-party services and grants you complete control over your media.

Essential Requirements for Seamless Plex Installation on Ubuntu

Transforming your Ubuntu VPS into a robust media server is a breeze! Simply acquire a VPS with ample storage, RAM, and CPU. Install Plex to seamlessly manage your media libraries.

Ensure compatibility by running a supported Ubuntu version; Plex typically supports Ubuntu 20.04 LTS and newer. Verify the specifics on the official Plex website.

To kick off Plex installation on Ubuntu, wield a user account boasting sudo privileges.

Elevate your experience by creating a Plex account for remote access, user control, and bonus features with a Plex Pass subscription. Optimize security by assigning a static IP address to your Ubuntu server for a stable and secure connection to other devices.”

Steps to Install Plex on Ubuntu Server

To install Plex in Ubuntu Linux, follow the following instructions:

1. Update System Packages

Before installing Plex or any new software on Ubuntu, it is recommended to ensure that your packages and repositories are up to date. Therefore, open the terminal and run the following commands:

sudo apt update 

sudo apt upgrade

By running the previous commands, you upgraded and updated your system’s old packages.

2. Install Dependencies

For the initial installation of Plex on Ubuntu, make sure to install the following packages first:

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl -y

3. Download and Install Plex Media Server

To efficiently install and update Plex, you should add the official Plex repository to your Ubuntu system so that you can directly install and update Plex from its official repository. To import the Plex repository to an Ubuntu system and install the Plex Media Server, follow the steps below:

  • To ensure the validity of the package, add the Plex GPG key to the apt repository:

curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add –

  • Then add the Plex repository to your system resource list:

echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/

  • Update the package database once again to refresh the cache and reflect the new repository:

sudo apt update

As you can see, you have added the Plex repositories to your system’s source list, and now you can install the Plex Media Server through these repositories.

  • Install Plex Media Server on Ubuntu:

sudo apt install plexmediaserver

Output

Reading package lists… Done Building dependency tree… Done Reading state information … Done Recommended packages: beignet-opencl-icd The following NEW packages will be installed: plexmediaserver 0 upgraded, 1 newly installed, 0 to remove and 10 not upgraded.

As a result, all Plex dependencies, along with the Plex Media Server and everything you need, will be installed.

4. Check the Plex Media Server Status

Once the installation is finished, the Plex service will begin running on its own. To ensure that the Plex software has been installed correctly and is functioning properly, use the following command to check the status of the Plex service.

sudo systemctl status plexmediaserver

The “Active: active(running)” in the previous command output indicates that Plex will start up automatically every time you reboot the server, so you don’t need to worry.

5. Start and Enable Plex

If you notice that the service is not active, execute the following commands to start the Plex Media Server and enable it for automatic startup during boot:

sudo systemctl start plexmediaserver sudo systemctl enable plexmediaserver

Also, to restart the Plex service, use the following command:

sudo systemctl restart plexmediaserver

6.Setting Up Firewall Configuration

If you use a firewall like UFW on your Ubuntu system, you need to configure it to allow  Plex Media Server to communicate over the network. This is especially important for remote access features. By default, the UFW firewall is active, but for assurance, you can first check the status of the UFW firewall:

sudo ufw status

Result

inactive

If the firewall is inactive, enable it first:

sudo ufw enable

Plex Media Server typically uses port 32400 by default, so to allow access to the Plex Media server, open the default Plex port on the UFW firewall:

sudo ufw allow 32400

7. Setting Up an SSH tunnel on a remote Ubuntu server for Plex

If you want to access your Plex server remotely from other devices, you need to log in to your Plex account and configure remote access settings to stream your media outside your local network. If you have set up Plex on a remote Ubuntu server, setting up an SSH tunnel on your local system is a good way to enable external connections. If you are setting up SSH for the first time, run the following command:

sudo apt install openssh-server -y

Then enter the following command to set up an SSH tunnel for Plex on the Ubuntu server:

ssh {server-ip-address} -L 8888:localhost:32400

Now start the service by typing the following command:

sudo systemctl enable ssh -y

To access the Plex Media Server, launch your web browser and type the following:

http://localhost:8888/web

8. Configure Plex on Linux Ubuntu

After installing Plex on the remote Ubuntu server, go to the following address via a user-friendly web browser interface:

http://localhost:32400/web

Troubleshooting Plex: if media is not appearing while adding to Plex

One of the most common issues you may encounter during the initial setup process of Plex on Ubuntu is that when adding media content to Plex, it’s possible that some media may not be recognized for adding, or Plex may face issues when picking up the media.

This problem can be frustrating as it presents challenges when adding your media to Plex.

Solution: Configuring File and Media Folder Permissions in Plex Media Server

This issue is related to the permissions for reading and executing your media files and folders.To display and access your media files and folders, you need to configure read and execute permissions for the media content directories in your dedicated Plex user account, named Plexuser. Otherwise, Plex will be unable to display or pick up the media content without the necessary read and execute permissions.

Commands such as chown (for changing ownership) or setfacl (for setting file access control lists (ACLs) to manage permissions) are useful for setting permissions in Ubuntu.

Therefore, by using these commands, you can apply these permissions:

  • Applying permissions in Ubuntu using the chown command:

sudo chown -R plex:plex /media/yourfolder/

If there are other folders on your hard disk that you want to hide from Plex’s access, run the following command:

sudo chown -R plex:plex /media/yourfolder/tv sudo chown -R plex:plex /media/yourfolder/movies

  • Applying permissions in Ubuntu using the setfacl command:

sudo setfacl -R -m u:plex:rx /media/yourfolder/ sudo setfacl -R -m u:plex:rx /media/yourfolder/tv sudo setfacl -R -m u:plex:rx /media/yourfolder/movies

Executing the previous commands requires the installation of the ACL package. If your Ubuntu system does not support ACL, you can install the ACL package by running the following command:

sudo apt install acl

Deleting Plex Media Server

You may no longer need Plex Media Server and want to remove it from your system. To achieve this, you can simply run the following command:

sudo apt autoremove plexmediaserver –purge -y

If you don’t intend to reinstall Plex Media Server and want to remove it completely, you can delete its official repository, which is located in the /etc/apt/sources.list.d/ directory, using the “rm” command:

sudo rm /etc/apt/sources.list.d/plexmediaserver.list

For a complete and permanent removal of the Plex Media Server in Ubuntu, you won’t need the GPG key anymore. Therefore, by executing the following command, you can get rid of the GPG key:

sudo rm usr/share/keyrings/plex.gpg

Key Considerations for Setting Up and Utilizing Plex on Ubuntu

  • Don’t overlook the importance of creating and organizing media libraries systematically to create an optimal, fast, and smooth experience.
  • Installing Plugins is crucial for optimizing Plex usage and creating a great experience. Manually install Plugins (placing Plugin files in the Plug-ins directory) to utilize their features for enhancing Plex.
  • Customize the appearance of Plex Media Server by using skins that match your preferences.
  • To optimize streaming performance, configure the server’s transcoding settings through “Settings > Transcoder.”
  • Enable subtitles by going to Settings and selecting “Server > Languages.”
  • We always recommend not leaving the application to its own but regularly monitoring and controlling the Plex media server’s performance (bandwidth usage, issue identification, and resolution) through the internal dashboard or other software for desired results.
  • It’s always a good practice to back up your Plex configuration and databases before making significant changes.

Plex on Ubuntu

Read More; How can I insert 7Zip in Ubuntu, Debian, Centos & Fedora

Follow us on, Meta , X, Instagram .