How To Setup Plex Media Server On CentOS 7


How To Setup Plex Media Server On CentOS 7

Plex is a popular media streaming server software, which allows you to organize and stream digital media like video and audio to your devices anywhere in the world provided you have an internet connection.

Plex can be installed on many different devices including:

  • Windows PC’s
  • Mac PC’s
  • Linux Servers
  • Raspberry Pis
  • NAS Devices

In this guide we will show you how you can install Plex Media Server on your Centos 7 server, as well as how to access the server and stream media to a compatible device running the Plex client application.

For this configuration we would recommend a server with a substantial amount of storage space for media, as well as a decent processor.

 

Prerequisites

Before installing Plex you will need to ensure that you have the correct prerequisites configured.

First, run yum update to update all of your repositories to the latest versions:

yum -y update

If you haven’t already, install the wget repository with the following command:

yum -y install wget

Finally, Plex requires a user account which you can create at this stage by signing up at their website here.

 

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!