How to Install Plex Media Server on CentOS 7

Published on

4 min read

Install Plex Media Server on CentOS 7

Plex is a streaming media server that brings all your video, music and photo collections together and stream them to your devices at any time and from anywhere.

In this tutorial, we will show you how to install and configure Plex Media Server on CentOS 7.

Prerequisites

Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges .

Install Plex Media Server

The recommended method to install and manage Plex Media Server on CentOS 7 is by using the Plex official repository. It requires no technical knowledge and it should not take you more than 20 minutes to install and configure the media server.

The following steps describe how to install Plex Media Server on a CentOS system:

  1. Add the Plex repository

    To enable the Plex repository open your text editor and create a new YUM repository configuration file named plex.repo in /etc/yum.repos.d/ directory:

    /etc/yum.repos.d/plex.repo
    [PlexRepo]
    name=PlexRepo
    baseurl=https://downloads.plex.tv/repo/rpm/$basearch/
    enabled=1
    gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key
    gpgcheck=1
  2. Install Plex

    Install the latest version of the Plex Media Server with:

    sudo yum install plexmediaserver

    Once the installation is completed start the plexmediaserver service and enable it to start on system boot with the following commands:

    sudo systemctl start plexmediaserver.servicesudo systemctl enable plexmediaserver.service
  3. Verify the installation

    To verify if the Plex service is running type:

    sudo systemctl status plexmediaserver
    ● plexmediaserver.service - Plex Media Server for Linux
       Loaded: loaded (/usr/lib/systemd/system/plexmediaserver.service; enabled; vendor preset: disabled)
       Active: active (running) since Sat 2018-07-21 22:22:22 UTC; 12s ago
     Main PID: 13940 (Plex Media Serv)
       CGroup: /system.slice/plexmediaserver.service

Adjust the Firewall Rules

Now that Plex is installed and running you need to configure your firewall to allow traffic on Plex Media Server specific ports.

If you don’t have firewall enabled on your system, you can skip this section.

Open your text editor of choice and create the following Firewalld service:

/etc/firewalld/services/plexmediaserver.xml
<?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>

Save the file and apply the new firewall rules by typing:

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

Finally check if the new firewall rules are applied successfully with:

sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: eth0
  sources:
  services: ssh dhcpv6-client plexmediaserver
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

Configure Plex Media Server

Create the directories in which you will keep your media files:

sudo mkdir -p /opt/plexmedia/{movies,series}

The Plex Media Server runs as the user plex which needs to have read and execute permissions to the media files and directories. To set the correct ownership run the following command.

sudo chown -R plex: /opt/plexmedia
You can choose any location to store the media files, just make sure you set the correct permissions.

Open your browser, type http://YOUR_SERVER_IP:32400/web and you will be presented with a setup wizard, which will guide you trough the Plex configuration:

Plex Media Server Sign In

In order to use the Plex Media Server, you will need to create an account.

Press the Google, Facebook or Email button to create a free Plex account. If you want to access premium features you can purchase a Plex Pass plan.

Once you sign up you will be redirected to the page with information about how Plex works as shown below:

How Plex Works

Click on the Got it button.

On the next screen enter your Plex server name, leave the Allow me to access my media outside my home box checked, and click Next.

Plex Server Setup Hostname

The next step is to add a media library. Click on the Add Library button.

When the popup window shows, select movies as library type and click Next.

Plex Media Server Add Library

In the next step click on the Browse for media folder and add the path to the directory that will contain the Movies media files, in our case /opt/plexmedia/movies.

Plex Media Server Movies Folder

Click on the Add button and then on the Add Library.

You can add as many Libraries as you want.

Plex Media Library

Click Next, then Done and you will be redirected to the Plex web dashboard.

Plex Media Server Dashboard

Now that you have completed the setup wizard, you can start exploring Plex options and all the things it can do.

Conclusion

You have learned how to install Plex Media Server on your CentOS 7 machine and how to create a Media Library.

You can now install the Plex application on your Android, iPhone, Smart TV, Xbox, Roku or any other supported device. You can find a list of supported Apps & Devices on the Plex Downloads page or you can simply install the application from the device’s app store.

You should also check out the official Plex Quick-Start guide and Plex Documentation page.

If you have any questions, please leave a comment below.