Install Plex Media Server on Almalinux 8/9 – Best Setup
In this guide, you will learn how to Install Plex Media Server on Almalinux 8/9. Plex Media Server is a powerful and versatile organizational tool that allows you to access your digital libraries – including music, photos, and videos – from virtually any computer or mobile device. It acts as a central hub for your media, streamlining access and providing a user-friendly interface for managing and enjoying your content.
Plex is cross-platform and can be run on most operating systems, making it a popular choice for home media enthusiasts. The following steps, provided by the Orcacore team, will walk you through the installation process on AlmaLinux. This guide is applicable to both AlmaLinux 8 and AlmaLinux 9. You will successfully Install Plex Media Server on Almalinux 8/9.
Before proceeding, ensure you have the following prerequisites:
- Access to your AlmaLinux server as a non-root user with
sudo
privileges. -
A basic firewall set up and configured. Refer to the following guides for initial server setup:
- A domain name pointed to your server’s IP address (optional, but recommended for easier access).
Let’s begin the steps to Install Plex Media Server on Almalinux 8/9.
Step 1 – Download and Install Plex on AlmaLinux
First, update your system packages to ensure you have the latest versions:
sudo dnf update -y
Next, visit the Plex downloads page and obtain the direct download link for the latest RPM package. Use the wget
command to download the package to your server. You can utilize the wget command.
sudo wget https://downloads.plex.tv/plex-media-server-new/1.32.5.7349-8f4248874/redhat/plexmediaserver-1.32.5.7349-8f4248874.x86_64.rpm
Note: The version number in the URL may change. Always download the latest version.
Once the download is complete, install the Plex Media Server using the following command:
sudo dnf install plexmediaserver-1.32.5.7349-8f4248874.x86_64.rpm
Step 2 – Enable and Start Plex Media Service on AlmaLinux
With the installation complete, you need to enable and start the Plex Media Server service. This ensures that Plex starts automatically on boot and is currently running.
sudo systemctl enable plexmediaserver
sudo systemctl start plexmediaserver
Verify that the Plex Media Server is active and running using the following command:
sudo systemctl status plexmediaserver
Output:
● plexmediaserver.service - Plex Media Server
Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
Active: **active** (**running**) since Mon 2023-09-04 06:03:51 EDT; 3min 31s ago
Main PID: 75468 (Plex Media Serv)
Tasks: 111 (limit: 23609)
Memory: 241.2M
CPU: 46.370s
CGroup: /system.slice/plexmediaserver.service
...
The output confirms that the service is running.
Step 3 – Configure Firewall For Plex Media Server
Assuming you have firewalld
running, you need to allow Plex service and port 80 through your firewall.
sudo firewall-cmd --add-service=plex --zone=public --permanent
sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
Reload the firewall to apply the changes:
sudo firewall-cmd --reload
Step 4 – Configure Apache as a Reverse Proxy for Plex
Using Apache as a reverse proxy allows you to access Plex through a standard web port (80 or 443) and use your domain name. First, install Apache:
sudo dnf install httpd -y
Start and enable the Apache service:
sudo systemctl enable --now httpd
Allow HTTPD scripts and modules to connect to the network:
sudo setsebool -P httpd_can_network_connect on
Create an Apache virtual host file. You can use a text editor like vi editor:
sudo vi /etc/httpd/conf.d/plexmedia.conf
Add the following content to the file:
<VirtualHost *:80>
ServerName example.com
ErrorDocument 404 /404.html
#HTTP proxy
ProxyPreserveHost On
ProxyPass / http://localhost:32400/
ProxyPassReverse / http://localhost:32400/
#Websocket proxy
<Location /:/websockets/notifications>
ProxyPass wss://localhost:32400/:/websockets/notifications
ProxyPassReverse wss://localhost:32400/:/websockets/notifications
</Location>
</VirtualHost>
Replace example.com
with your actual domain name. Save and close the file.
Check the Apache virtual host file for syntax errors:
apachectl -t
Output:
Syntax OK
Reload Apache to apply the changes:
sudo systemctl reload httpd
Step 5 – Access and Set up Plex Media Server From Web Interface
You can now access your Plex Media Server through the web interface by navigating to the following URL in your web browser:
http://yourserver-ip:32400/web
Or, if you configured the Apache reverse proxy:
http://example.com
You will be prompted to sign in with a Plex account. If you don’t have one, you’ll need to create one.
After signing in, you will see the Plex Media Server dashboard.
From the dashboard, you can add your media libraries and configure your server. You can enjoy your digital items from any device. The free version has limited features. You can upgrade to Plex Premium for additional functionality.
Conclusion
You have successfully learned to Install Plex Media Server on Almalinux 8/9. You accomplished this by downloading the RPM package, configuring the firewall, and setting up Apache as a reverse proxy. You can now access and configure Plex through the web interface.
This guide is applicable to both RHEL 8 and RHEL 9.
Hope you enjoy using Plex Media Server!
Now, let’s explore alternative methods for achieving the same goal.
Alternative Solutions for Installing Plex Media Server
While the above method is a solid approach, let’s consider two alternative ways to install and access Plex Media Server on AlmaLinux:
1. Using Docker Compose:
Docker provides a containerization platform that simplifies application deployment. Using Docker Compose, you can define and manage multi-container Docker applications. This approach offers better isolation, portability, and easier updates.
-
Explanation: This method involves creating a
docker-compose.yml
file that defines the Plex Media Server container, along with any necessary dependencies. Thedocker-compose up
command then builds and starts the container. -
Code Example:
First, install Docker and Docker Compose:
sudo dnf install docker -y sudo systemctl start docker sudo systemctl enable docker sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose sudo chmod +x /usr/local/bin/docker-compose
Create a
docker-compose.yml
file:sudo vi docker-compose.yml
Add the following content:
version: "3.8" services: plex: image: plexinc/pms-docker:latest container_name: plexmediaserver restart: unless-stopped ports: - "32400:32400/tcp" - "3005:3005/tcp" - "8324:8324/tcp" - "32469:32469/tcp" - "1900:1900/udp" - "32410:32410/udp" - "32412:32412/udp" - "32413:32413/udp" - "32414:32414/udp" environment: - PLEX_CLAIM=YOUR_PLEX_CLAIM_TOKEN # Optional, if you have a claim token - TZ=Your/Timezone # Replace with your timezone volumes: - /path/to/plex/config:/config - /path/to/your/media:/data network_mode: host
Replace
YOUR_PLEX_CLAIM_TOKEN
with your Plex claim token (if you have one),Your/Timezone
with your correct timezone,/path/to/plex/config
with the directory you want to store the Plex configuration files, and/path/to/your/media
with the directory containing your media files.Finally, start the container:
sudo docker-compose up -d
You can then access Plex through
http://yourserver-ip:32400/web
.
2. Using Nginx as a Reverse Proxy instead of Apache:
Instead of Apache, Nginx is another popular and efficient web server that can be used as a reverse proxy for Plex. Nginx is known for its performance and resource efficiency, making it a suitable alternative.
-
Explanation: This involves installing Nginx, configuring a virtual host file, and setting up the reverse proxy directives to forward requests to the Plex Media Server.
-
Code Example:
First, install Nginx:
sudo dnf install nginx -y sudo systemctl start nginx sudo systemctl enable nginx
Create an Nginx configuration file:
sudo vi /etc/nginx/conf.d/plex.conf
Add the following content:
server { listen 80; server_name example.com; location / { proxy_pass http://localhost: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; # Websocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
Replace
example.com
with your domain name.Test the Nginx configuration:
sudo nginx -t
Reload Nginx to apply the changes:
sudo systemctl reload nginx
Now, access Plex through
http://example.com
.
These alternative methods offer different approaches to installing and accessing Plex Media Server on AlmaLinux, providing flexibility based on your specific needs and preferences. The first solution of the article showed you how to Install Plex Media Server on Almalinux 8/9.