Skip to content

Install Plex Media Server on CentOS 7

This guide will walk you through installing, updating, and configuring the firewall for Plex Media Server on Centos 7. We will assume you have the basic knowledge to get CentOS installed, how to install packages with yum, and how to use sudo.

If you don’t know what Plex is, check out https://www.plex.tv/.

Installation

Create the Plex user; this account will run Plex Media Server and cannot be used to log in.

sudo useradd -s /sbin/nologin plex

You can optionally specify the user id of the Plex user. This is helpful if need to sync the UID of a user on another Linux server (e.g., a CouchPotato or Sonarr box) so you don’t have permission issues.

sudo useradd -u 1005 -s /sbin/nologin plex

Next we update yum, clean the yum cache, and install some prerequisites in case you don’t already have them.

sudo yum update -y
sudo yum clean all
sudo yum install -y wget bzip2

Determine the latest version of Plex Media Server and download the RPM; I like to do this in my home directory. There are ways we can automate obtaining the latest version, but we won’t cover this here.

You can find the latest version by going to https://www.plex.tv/downloads/ and selecting Linux. The latest version will be displayed on the screen.

cd ~
export PLEX_LATEST=1.5.5.3634-995f1dead
wget https://downloads.plex.tv/plex-media-server/$PLEX_LATEST/plexmediaserver-$PLEX_LATEST.x86_64.rpm

Install the RPM you just downloaded.

sudo rpm -i plexmediaserver-$PLEX_LATEST.x86_64.rpm

Optionally clean up the RPM when you’re done installing.

rm plexmediaserver-$PLEX_LATEST.x86_64.rpm

Start Plex and optionally configure it to start when your server restarts.

sudo systemctl start plexmediaserver
sudo systemctl enable plexmediaserver

That’s it, Plex Media Server is installed. You probably need to open your firewall if you’ve not done so already, so we’ll cover that next.

Firewall

Here we are going to go through configuring the CentOS firewall to allow Plex traffic.

Start by making a service so that you can easily add all the ports you might need. The only required port is 32400/tcp, but other ports can be opened to allow different Plex features like DLNA and Bonjour to play nicely on your network. You can find more information about each port’s purpose at https://support.plex.tv/.

sudo vi /etc/firewalld/services/plexmediaserver.xml

Add the following to that file and save it:

<?xml version="1.0" encoding="utf-8"?>
<service version="1.0">
<short>plexmediaserver</short>
<description>Plex TV Media Server</description>
<port port="1900" protocol="udp"/>
<port port="5353" protocol="udp"/>
<port port="32400" protocol="tcp"/>
<port port="32410" protocol="udp"/>
<port port="32412" protocol="udp"/>
<port port="32413" protocol="udp"/>
<port port="32414" protocol="udp"/>
<port port="32469" protocol="tcp"/>
</service>

Add the service to the firewall and reload it for your changes to take effect. Note that you may need to add --zone=[zone name] if you put your default network adapter in a specific zone (e.g., --zone=internal).

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

That’s it, your firewall should be all set up. I like to test that I can talk to port 32400 from another machine on my network (assumes telnet is installed).

telnet [plex server IP address] 32400

If Plex is running and the port is open, should expect to see something like the following:

Trying 10.0.0.5...
Connected to 10.0.0.5.
Escape character is '^]'.

Accessing Plex

Once Plex is up and running, and the firewall has been configured, you can navigate to web interface to begin configuration using a URL like the one below.

http://[plex server IP address]:32400/web/index.html

Updating Plex

To update Plex, you must first uninstall the old version, leaving the /var/lib/plexmediaserver files in place to preserve your library, then install the new version. The procedure below will guide you through stopping Plex, removing the old installation, downloading and installing the latest RPM, and starting Plex.

sudo systemctl stop plexmediaserver
sudo rpm -e plexmediaserver

cd ~
export PLEX_LATEST=1.5.5.3634-995f1dead
wget https://downloads.plex.tv/plex-media-server/$PLEX_LATEST/plexmediaserver-$PLEX_LATEST.x86_64.rpm
sudo rpm -i plexmediaserver-$PLEX_LATEST.x86_64.rpm

sudo systemctl start plexmediaserver

Note that it may take a couple minutes to load the web interface after updating and restarting Plex.

What’s Next?

We won’t go through configuring Plex since that process is OS-agnostic and you really can’t beat Plex’s own documentation. Check out the Quick-Start guide here.

You may also want to set up a local DNS and simple reverse proxy server so that you don’t need to enter an IP address and a port number when using Plex on your own network. We’ve got some related guides that you can browse through to find out more about these options.

Published inGuides

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *