How to install and configure Plex Media Server on CentOS 7

Plex is a streaming media server that brings all your collection of video, music, photo, and streaming media files to your device anytime, anywhere.

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

precondition

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

Install Plex Media Server

The recommended way to install and manage Plex Media Server on CentOS 7 is to use the official Plex repository. This method requires no technical knowledge and only takes about 20 minutes to install and configure this media server.

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

  1. Add a Plex repository
    To enable the Plex repository, open your text editor and create a new YUM repository configuration file named plex.repo in the directory /etc/yum.repos.d/ :
    sudo nano /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 Plex Media Server by typing the command:
    sudo yum install plexmediaserver

    After the installation is complete, run the service plexmediaserver And enable it to start automatically on system boot with the following command:

    sudo systemctl start plexmediaserver.service
    sudo systemctl enable plexmediaserver.service
  3. Verify that Plex is installed
    To check 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 2222 UTC; 12s ago
     Main PID: 13940 (Plex Media Serv)
       CGroup: /system.slice/plexmediaserver.service

Customize firewall rules

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

See also  How to install and configure Ansible AWX on CentOS 8

If for some reason you do not want to enable the firewall on your system, you can skip this section.

To setup open your favorite text editor and create the following firewall service:

sudo nano /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 rule by typing:

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

Last step, please check if the new firewall rules have been applied successfully by:

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 the Plex Media Server

Create a directory where you store media files:

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

Plex Media Server runs as a user plex Which need read and execute privileges for media files and directories. To set the correct ownership, run the following chown command.

sudo chown -R plex: /opt/plexmedia

You can choose any location to save the media files, make sure you set the correct permissions.

Open the browser and type http://SERVER-IP:32400/web And you will be presented with a setup wizard that will guide you through configuring Plex:

plex media server configuration - login

To use Plex Media Server, you must create an account.

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

After signing up, you will be redirected to a page with information on how Plex works as shown below.

See also  How to install and configure OrangeScrum on CentOS 8

Configuring a plex media server - How a plex works

Click the button Got it.

On the next screen, enter your Plex server name, and leave the checkbox turned on Allow me to access my media outside my homeand click Next.

plex media server configuration - plex setup hostname

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

When the popup appears, select Movies as the library type and click the button Next.

plex media server configuration - add plex media server

In the next step, click on the folder Browse for media And add the path to the directory that will contain the movie media files, in this case we take the example /opt/plexmedia/movies.

plex media server configuration - plex media server group folder

Click the button Add and then Add Library.

You can add as many libraries as you like.

plex media server configuration - plex media library

click Nextthen press Done And you will be redirected to the Plex web control panel.

Plex Media Server Configuration - Plex Web Dashboard

Now that you’ve completed the setup wizard, you can start exploring Plex’s options and everything it can do.

conclusion

You learned how to install Plex Media Server on a CentOS 7 machine and how to create a media library.

You can now install the Plex app on your Android, iPhone, Smart TV, Xbox, Roku, or other supported device. You can find a list of supported apps and devices on the Plex download page or you can install the app from your device’s App Store.

You should also check out the official Plex Quick Start Guide and the Plex documentation page.

Source link