How To Setup Plex Media Server On CentOS 7
Plex is a widely acclaimed media streaming server software that empowers you to organize, manage, and stream your digital media, such as videos, music, and photos, to any device, anywhere in the world, as long as you have an internet connection. It provides a seamless way to access your media library across multiple devices without hassle.
Plex can be installed on a variety of platforms, including:
- Windows PCs
- Mac PCs
- Linux Servers
- Raspberry Pi devices
- Network-Attached Storage (NAS) devices
In this comprehensive guide, we will walk you through the steps to install Plex Media Server on a CentOS 7 server, ensuring you can efficiently access your media library from any compatible device running the Plex client application.
To ensure optimal performance, we recommend setting up Plex on a dedicated server with ample storage space for your media files and a robust processor to handle the streaming demands. For high-performance server options, you can explore UKHost4u’s dedicated servers to find a solution that meets your needs.
By following this guide, you’ll be able to transform your CentOS 7 server into a powerful media hub, enabling you to enjoy your favorite media content anytime, anywhere.
Prerequisites
Before proceeding with the installation of Plex Media Server on your CentOS 7 server, it’s essential to ensure that you have the necessary prerequisites configured correctly. Proper preparation will help streamline the installation process and minimize potential issues.
Start by updating all of your repositories to the latest versions. This can be done by running the following command.
yum -y update
Next, if you haven’t already installed the wget
utility, you can do so with the following command. This tool is essential for downloading files directly from the internet.
yum -y install wget
Additionally, Plex requires a user account to access and manage your media server. If you haven’t created an account yet, you can easily sign up for one on their official website. Create your Plex account here to get started.
Having these prerequisites in place will ensure a smooth installation process, allowing you to efficiently set up and manage your Plex Media Server
Installation
Go to the Plex downloads page and copy the installation link for CentOS 64-bit. Once you have this link copied, use the wget command to download the installation file from the website:
wget https://downloads.plex.tv/plex-media-server/1.5.5.3634-995f1dead/plexmediaserver-1.5.5.3634-995f1dead.x86_64.rpm
When we have this .rpm file, we can install Plex Media Server with the yum install command:
yum install plexmediaserver*.rpm
Finally, you should enable Plex to start on boot, and start the server:
systemctl enable plexmediaserver.service systemctl start plexmediaserver.service
(you can verify that Plex is running with the following command:)
systemctl status plexmediaserver.service
Configuring Firewall Rules
Now before we access Plex through our device, we need to setup the correct Firewall rules for our Centos 7 server.
First, use the following command to install firewalld (if it’s not already):
sudo yum -y install firewalld
Now, start the firewalld service and set it to launch at boot:
systemctl start firewalld systemctl enable firewalld
Next is creating the firewall configuration in the form of an XML file.
Go to the ‘/etc/firewalld/services/’ directory and create the new service firewalld configuration ‘plex.xml’ using a text editor (you can use Vim or any other alternative):
cd /etc/firewalld/services/ nano plexmediaserver.xml
In this file, paste the following:
<?xml version="1.0" encoding="utf-8"?> <service> <short>plexmediaserver</short> <description>Ports required by plexmediaserver.</description> <port protocol="tcp" port="32400"></port> <port protocol="udp" port="1900"></port> <port protocol="tcp" port="3005"></port> <port protocol="udp" port="5353"></port> <port protocol="tcp" port="8324"></port> <port protocol="udp" port="32410"></port> <port protocol="udp" port="32412"></port> <port protocol="udp" port="32413"></port> <port protocol="udp" port="32414"></port> <port protocol="tcp" port="32469"></port> </service>
Once you’ve done this, save the file and exit the text editor.
Finally, add the ‘plexmediaserver’ service to the firewalld services list, and reload the configuration:
sudo firewall-cmd --add-service=plexmediaserver --permanent sudo firewall-cmd --reload
You can verify that the plexmediaserver service is running with the following command:
firewall-cmd --list-all
If the service is working correctly, you’ll see an output similar to the following (note the plexmediaserver service).
Configuring Plex Media Server
Initial Setup
Configuring the Plex server is done via the web interface, however before you can connect to this you need to create an SSH tunnel to your server. In the following form, substitute USER with the user/root, and 192.0.2.1 with the public IP address of the Plex server:
ssh user@192.0.2.1 -L 8888:localhost:32400
Now that you have established an SSH tunnel with the server, you can enter the Plex web interface by entering the following URL into your web browser:
http://localhost:8888/web
If the installation was successful, you will see the Plex login screen where you can now enter your login details or create a new user account with the ‘Sign Up’ link.
If successful, on your first login you should see a screen explaining how Plex works:
Hit ‘Got It’, and move on to the next page.
Set a name for your Plex server and make sure that “Allow me to access my media outside my home” is checked.
Now we are at the stage where you can configure your Plex library. You can choose to add library folders now, or leave it until later on. In this case we will add the libraries after finishing the setup process.
Your Plex media server should now be setup and you should see the following page:
Here you can select “Done” and proceed on to the Plex Dashboard.
Adding Libraries
Now that our Plex media server is fully configured, we can add Libraries where your media is stored for Plex to access.
Select ‘Add Library’.
Once you’ve selected the type of media you want to add, you’ll be prompted to choose the folder that the media is stored in.
When you’ve added the library, Plex will scan for appropriate media files to play.
If it’s detected any media files, they will be displayed in the relevant Library as our example below shows:
Connecting To Plex Remotely
Accesing your media on mobile devices is done through the Plex app, which can be found on the Google Play Store for Android, and the App Store for iOS.
Search for the Plex app in the google play store and install it to your device first.
When prompted for login details, use the Plex account details you created earlier on.
After logging on you’ll be greeted with tips on how to use the app’s interface, and you’ll also see your media files in your libraries.
On the top of the screen you can select the device to load content from, or to cast media to any available devices like TVs or Chromecasts.
Know an easier way to setup Plex, or have a favourite alternative media server?
Let us know in the comments below!