How to Install Plex Media Server on Fedora 40 or 39

Plex Media Server is a versatile and popular media management tool that allows you to organize, stream, and access your media content across a wide range of devices. Whether you have a large collection of movies, music, TV shows, or photos, Plex provides a seamless way to manage and stream your media both locally and remotely. It supports a wide array of platforms and offers a user-friendly interface that makes it easy to set up and customize according to your preferences. Plex Media Server is especially favored for its ability to transcode content on the fly, ensuring compatibility with various devices.

On Fedora 40 or 39, you can install Plex Media Server via Plex’s official RPM repository, which ensures you have access to the latest stable version and future updates. This guide will not only walk you through the installation process using the command-line terminal but also cover essential first-time setup steps, including folder and file permissions. These tips will help you get your media server up and running smoothly, allowing you to enjoy your media content with minimal hassle.

Update the Fedora System Before Plex Installation

Before beginning the installation process, it’s essential to update your Fedora system to ensure all existing packages are up to date. This helps prevent potential conflicts and ensures a smooth installation experience.

To update your system, execute the following command:

sudo dnf upgrade --refresh

Import Plex RPM Repository

You must import the Plex RPM repository to install Plex Media Server directly from its official repositories. This method allows you to receive the latest version of Plex as soon as it’s released without waiting for third-party maintainers to update their packages. To import the Plex RPM repository, execute the following command:

sudo tee /etc/yum.repos.d/plex.repo<<EOF
[Plexrepo]
name=plexrepo
baseurl=https://downloads.plex.tv/repo/rpm/\$basearch/
enabled=1
gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key
gpgcheck=1
EOF

This command creates a new repository configuration file in the /etc/yum.repos.d directory and adds the necessary information to access the official Plex RPM repository.

Install Plex Media Server via DNF Command

With the repository in place, you can install Plex Media Server on your Fedora system. To do so, run the following “dnf install” command:

sudo dnf install plexmediaserver -y

This command fetches the Plex Media Server package from the repository and installs it on your system.

Verify and Configure Plex Media Server

Once the installation is complete, verifying that the Plex Media Server service has started correctly is crucial. To check the status of the Plex Media Server, use the following systemctl status command:

systemctl status plexmediaserver

If the service is not running or inactive, you can start it with the following command:

sudo systemctl start plexmediaserver

To ensure that Plex Media Server starts automatically upon system boot, execute the following command:

sudo systemctl enable plexmediaserver

This command configures the Plex Media Server to start automatically when your Fedora system boots, ensuring your media library is always available.

Configure SSH for Plex Media Server (Optional)

Install OpenSSH Server on Fedora (if required)

Before configuring an SSH tunnel, ensure the OpenSSH server is installed on your remote Fedora server. If you’re unfamiliar with SSH or unsure whether it’s installed, you can install it using the following command:

sudo dnf install openssh-server -y

After installing the OpenSSH server, start the SSH service and enable it to run at startup:

sudo systemctl enable sshd --now

Set Up an SSH Tunnel for the Initial Setup

To allow remote connections during the initial setup, create an SSH tunnel from your local computer to the remote Fedora server. Replace {server-ip-address} with the actual IP address of your remote server (e.g., 192.168.50.1):

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

This command establishes an SSH tunnel between your local computer and the remote server, forwarding traffic from port 8888 on your local machine to port 32400 on the remote server.

Access Plex Media Server via SSH Tunnel

With the SSH tunnel in place, you can access the Plex Media Server through your web browser using the following URL:

http://localhost:8888/web

If the above URL doesn’t work, try the alternative URL:

localhost:32400/web/index.html#!/setup

These URLs redirect to http://localhost:32400/web on the remote server via the SSH tunnel, allowing you to complete the initial setup of your Plex Media Server.

Access Plex Media Server Remotely

After the initial setup, you can access your Plex Media Server remotely using your remote server’s IP address. Replace {server-ip-address} with the actual IP address of your remote server:

https://{server-ip-address}:32400

Following these steps, you’ve successfully configured an SSH tunnel to access your Plex Media Server remotely during the initial setup process, which is continued below.

Configure FirewallD for Plex Media Server

Create a Dedicated Zone for Plex

Start by adding a new dedicated zone for Plex within the FirewallD policy. This will allow you to manage the firewall rules for Plex separately from the rest of your system:

sudo firewall-cmd --permanent --new-zone=plex

Specify Allowed IP Addresses

Next, define the IP addresses permitted to access your Plex Media Server. Replace 1.2.3.4 with the actual IP address you want to add to the allow list:

sudo firewall-cmd --permanent --zone=plex --add-source=1.2.3.4

Repeat this command for each IP address you want to grant access to your server.

Open the Plex Port

By default, Plex uses TCP port 32400 for communication. Open this port in the plex zone to allow incoming connections:

sudo firewall-cmd --permanent --zone=plex --add-port=32400/tcp

If you change the default port in your Plex configuration file, update the firewall port rule accordingly.

Reload the Firewall

After configuring the firewall rules, reload FirewallD to apply the new settings:

sudo firewall-cmd --reload

First-Time Launch of Plex Media Server in WebUI

Step 1: Access the WebUI

Open your preferred internet browser and navigate to http://127.0.0.1:32400/web or http://localhost:32400/web to access the Plex WebUI.

Example:

Log in using an existing social media account or register a new account with your email if you’re new to Plex. Once logged in, you’ll begin the initial configuration setup.

Note: If your browser seems unresponsive during the first setup, hit the refresh button.

Step 2: Understand How Plex Works

The first configuration page provides an overview of Plex and its features.

Click “GOT IT!” to proceed to the next page.

Example:

Note: Firefox users may see a prompt to enable DRM, which is necessary for the Plex WebUI to function properly. Chrome and Chromium-based browser users won’t see this prompt.

Step 3: Consider Plex Pass (Optional)

You may be prompted to upgrade to Plex Pass. This optional upgrade offers benefits like HDR options and access to beta builds. You can always upgrade later, so click the “X” in the top right-hand corner to skip this step if desired.

Example:

Step 4: Server Setup

Configure your server name (you can choose any name) and decide whether to enable “Allow me to access my media outside my home.” By default, this option is enabled. If you don’t plan on accessing your media remotely, disable this feature.

Click “NEXT” to proceed.

Step 5: Set Up Your Media Library

The Media Library page allows you to pre-add your media directories if you have a media drive or folder ready.

Click “ADD LIBRARY”.

Select the type of media you want your folders to be organized into, such as TV shows, movies, or music.

Click “NEXT” to proceed to add folders.

Click “BROWSE FOR MEDIA FOLDER” and select the media directory.

Once the folder is added, advanced options will appear. Here, you can customize Plex further.

Click “ADD LIBRARY” to continue with the initial configuration setup.

Step 6: Complete the Setup

Click “NEXT” to finish the initial setup, with or without adding a media library.

The next screen will confirm that your setup is complete. Click “DONE” to proceed to the Plex Dashboard.

You will be prompted to set up pins. Leave them as default or edit them to your preference. You can adjust these settings later, and then you will arrive at your Plex Dashboard.

Configure Media Files & Folders Permissions

During the initial setup of Plex Media Server, you may encounter issues with your media not appearing or problems adding content not detected by Plex. This can happen if Plex can’t find the content on your existing internal or external hard drives. The primary cause for this issue is that Plex creates a dedicated user account named plexuser, which requires reading and executing permissions on your media directories.

To resolve this issue, you can set the appropriate permissions on your media files and folders using chown or setfacl commands in Fedora. Both methods are effective, and we will walk you through examples of each.

Configure Permissions Using setfacl

The setfacl command allows you to modify a file or directory’s access control list (ACL). In this case, you will grant the plexuser read and execute permissions on your media folders.

Here’s an example of how to use setfacl to set permissions:

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
sudo setfacl -R -m u:plex:rx /media/yourfolder/tv
sudo setfacl -R -m u:plex:rx /media/yourfolder/movies

Configure Permissions Using chown

The chown command allows you to change the owner and group of files or directories. You will use it to grant the plexuser ownership of your media folders.

Here’s an example of how to use chown to set permissions:

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

Replace /media/yourfolder/ with the path to your media directory.

If you have other folders within your hard drive that you don’t want Plex to access, you can set the permissions for individual folders instead:

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

Again, replace /media/yourfolder/ with the path to your media directory.

Set up Nginx as a Reverse Proxy for Plex Media Server

Setting up a reverse proxy for your Plex Media Server allows you to access it from a remote computer or network. In this tutorial, we’ll use Nginx as the proxy server.

Install Nginx on Fedora for Plex Media Server

First, install Nginx with the following command:

sudo dnf install nginx -y

If Nginx isn’t activated by default, start it using:

sudo systemctl start nginx

To enable Nginx to start on boot, run the following command:

sudo systemctl enable nginx

Now, check the status of Nginx to ensure it’s active and free of errors:

systemctl status nginx

Create a Nginx Server Block for the Plex Media Server

Next, create a new server block with the following command:

sudo nano /etc/nginx/conf.d/plex.conf

After creating your sub-domain, add the following content to the server block file:

server {
      listen 80;
      server_name plex.example.com;

      location / {
          proxy_pass http://127.0.0.1:32400;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

          #upgrade to WebSocket protocol when requested
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
      }
}

Replace plex.example.com with your own sub-domain. Save the file by pressing CTRL+O, then exit with CTRL+X.

Test the Nginx Configuration

Before proceeding, perform a dry run to ensure there are no errors in your Nginx configuration or server block:

sudo nginx -t

If everything is set up correctly, you should see the following output:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Reload Nginx

Reload Nginx for the changes to take effect:

sudo systemctl reload nginx

After you’ve set up your domain and DNS records to point to your server IP, you can now access your Plex Media Server at your chosen sub-domain, such as plex.example.com.

Secure Nginx with Let’s Encrypt SSL Free Certificate for Plex

You may want to run your Nginx on HTTPS for added security using an SSL certificate. One way to achieve this is by using Let’s Encrypt, a free, automated, and open certificate authority operated by the nonprofit Internet Security Research Group (ISRG).

Install the Certbot Package

First, install the certbot package with the following command:

sudo dnf install python3-certbot-nginx -y

Create the Certificate

Once the certbot package is installed, run the following command to create your certificate:

sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email you@example.com -d plex.example.com

This command configures a secure configuration, including force HTTPS 301 redirects, a Strict-Transport-Security header, and OCSP Stapling. Be sure to replace the email address and domain name with your information.

With these changes in place, your URL will now be https://plex.example.com instead of http://plex.example.com. If you use the old HTTP URL, it will automatically redirect to the HTTPS version.

Additional Plex Media Server Commands

This section will teach you additional commands for managing your Plex Media Server on Fedora Linux. We’ll cover how to update, remove, and manage the repository for your Plex Media Server.

Update Plex Media Server

Plex Media Server can be updated using the standard dnf update command, which is commonly used to upgrade packages on your Fedora system. To update Plex, run the following command:

sudo dnf update --refresh

Typically, your browser’s Plex Media Server GUI will notify you when updates are available. When you see this notification, run the above command to update your server.

Remove Plex Media Server

If you decide that you no longer wish to use Plex and want to remove it from your Fedora system, you can do so by executing the following command:

sudo dnf remove plexmediaserver

Note: If you’ve installed the Nginx reverse proxy, remember to disable it and, if necessary, delete the configuration file for your domain.

Remove the Plex Repository

To remove the Plex repository from your Fedora system, run the following command:

sudo rm /etc/yum.repos.d/plex.repo

Conclusion

Installing Plex Media Server on Fedora using the official RPM mirror ensures that you have the most up-to-date and secure version of the software. After installation, setting up your server correctly, including configuring folder and file permissions, is crucial for a smooth experience. Following the quick setup steps and tips provided will help you avoid common pitfalls and ensure that your media is organized and accessible across all your devices. With Plex, you can turn your Fedora system into a powerful media hub that streams your content anywhere, anytime.

Joshua James
Follow me
Latest posts by Joshua James (see all)

Leave a Comment