How to Install Plex Media Server on CentOS 7

Plex is a client-server media software suite. It has two main components, plex media server, and plex player.

Plex media server is an application that allows you to organize your media files like video, audio, photo, and other media from online sources, then stream them over the local network or over the internet. It can be installed on Windows, MacOS, Linux, and even FreeBSD system.

Plex Player is the front-end that allows you to play your media files over the local or remote computer that running the Plex media server.

In this tutorial, we will show you step-by-step how to install and configure Plex media server on your CentOS 7 server. We will install Plex Media Server from its own repository, then configure the Firewalld rules for the media server access, and finally, configure the Plex player using the Plex web app.

Prerequisites

  • CentOS 7 system
  • Root privileges

What we will do

  1. Add Plex Repository to the CentOS 7 System
  2. Install Plex Media Server on CentOS 7
  3. Configure Firewalld Rules for Plex Media Server
  4. Testing

Step 1 - Add Plex Repository

The first step we need to do for this guide is to add the Plex repository to our CentOS 7 system.

Go to the 'yum.repos.d' directory and create new repo file 'plex.repo' using the vim editor.

cd /etc/yum.repos.d/
vim plex.repo

Paste the following Plex repository configuration there.

# Plex.repo file will allow dynamic install/update of plexmediaserver.
[PlexRepo]
name=PlexRepo
baseurl=https://downloads.plex.tv/repo/rpm/$basearch/
enabled=1
gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key
gpgcheck=1

Save and exit.

Plex repository has been added to the CentOS 7 system.

Step 2 - Install Plex Media Server on CentOS 7

Now we will install Plex media server on our CentOS server.

Run the yum command below.

sudo yum -y install plexmediaserver

After the installation is complete, start the plex service and enable it to launch everytime at system boot using the systemctl commands below.

systemctl start plexmediaserver
systemctl enable plexmediaserver

Plex media server has been installed - check it using the following command.

systemctl status plexmediaserver

And you will get the result as shown below.

Start Plex Media Server

The Plex Media Server is now running on the CentOS 7 server.

Step 3 - Configure Firewalld Rules for Plex Media Server

In this tutorial, we will enable Firewalld services. Make sure firewalld packages are installed on the system.

Or you can install them using the yum command below.

sudo yum -y install firewalld

Now start the firewalld service and enable it to launch every time at system boot.

systemctl start firewalld
systemctl enable firewalld

Next, we need to add new firewalld configuration for our plex installation. Plex media server needs some port in the 'LISTEN' state, so we will create new firewalld XML configuration.

Go to the '/etc/firewalld/service' directory and create a new service firewalld configuration 'plex.xml' using vim.

cd /etc/firewalld/services/
vim plexmediaserver.xml

There, paste the following configuration.

<?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>

Save and exit.

Now add the 'plexmediaserver' service to the firewalld services list, then reload the configuration.

sudo firewall-cmd --add-service=plexmediaserver --permanent
sudo firewall-cmd --reload

And you will get the result as below.

Configure the firewall

The plexmediaserver service has been added to firewalld - check it using the firewalld command below.

firewall-cmd --list-all

And you should get 'plexmediaserver' on service list.

List firewall ports

Step 4 - Configure Plex Media Server

Before configuring the Plex media server, make sure you have an account for Plex. If not, you can register using the URL below.

https://app.plex.tv/

And then login to your account.

If you're a registered user and logged in with your browser, you can open your Plex media server installation url in the following way.

http://192.168.33.10:32400/web/

And you will be redirected to the plex login as below.

Plex media server login

Click the 'SIGN IN' button.

And you will get the page about how plex works - just click the GOT IT button.

How Plex works

Now the server setup page.

Plex server setup

Type your server name and click the 'NEXT' button.

Now you will see the page for plex library configuration.

Organize your media

Click the 'NEXT' button again.

And the plexmediaserver configuration has been completed - click the 'DONE' button.

Gat plex apps

And you will get the plex Dashboard.

Plex dashboard

Now you can add media files to your plex media server.

Below is an example library from our Plex installation.

Plex example media

Plex Media Server installation and configuration on CentOS 7 server has been completed successfully.

Reference

About Muhammad Arul

Muhammad Arul is a freelance system administrator and technical writer. He is working with Linux Environments for more than 5 years, an Open Source enthusiast and highly motivated on Linux installation and troubleshooting. Mostly working with RedHat/CentOS Linux and Ubuntu/Debian, Nginx and Apache web server, Proxmox, Zimbra Administration, and Website Optimization. Currently learning about OpenStack and Container Technology.

Share this page:

Suggested articles

1 Comment(s)

Add comment

Comments

By: Martin Ledvina at: 2018-10-06 12:57:56

Hi I appreaciate the nice work on this tutorial. I do have a few comments.

1. Adding the repo without importing the key

Instead of forcing Yes to all questions you should include:

rpm --import https://downloads.plex.tv/plex-keys/PlexSign.key

Note: GPG is there to authentificate the repository, so import the key only when you trust the network. Not randomly by adding -y option.

2. Adding the repo as enabled by default

It is a common practice not to enable 3rd party repos by default. They are used for specific packages and without priorities or protection can be used to spoof system repositories. CentOS Wiki on Yum

In this case it is easy to use --enablerepo option and leave enabled=0 (As Plex.tv does automatically upon installaton of RPM).

echo "*** Installing Plex Media Server"yum --enablerepo=PlexRepo install plexmediaserverecho "*** Updating Plex Media Server"yum --enablerepo=PlexRepo update plexmediaserver

3. Editing Services manually and all together (Web, DLNA, Local Network Discovery, Remote Control)

Here is a list of commands on how to add them through the interface: https://pastebin.com/821LCUrN

Also it is irresponsible to open all ports Plex uses in case people are not running the server on local network behind a different firewall. This is why I separate them according to the source: Plex.tv page

Run to have Web and remote access:

firewall-cmd --add-service=plexmediaserver --permanent

Run to have LAN and direct play:

firewall-cmd --add-service=plexmediaserver-dlna --permanent

firewall-cmd --add-service=plexmediaserver-discovery --permanent

Run to enable remote control with Plex Companion:

firewall-cmd --add-service=plexmediaserver-control --permanent