Install Plex on CentOS 7

Was just playing around. It’s a great home entertainment tool indeed.

Method-1: Creating repository and using Yum

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:

[PlexRepo]
name=PlexRepo
baseurl=https://downloads.plex.tv/repo/rpm/$basearch/
enabled=1
gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key
gpgcheck=1

Method-2: Installation using RPM

download the package for your Linux distro. It is much easier to do this by simply coping the download link location with right click and then you can run:

$ sudo rpm -ivh https://downloads.plex.tv/plex-media-server/1.13.8.5395-10d48da0d/plexmediaserver-1.13.8.5395-10d48da0d.x86_64.rpm

Alternatively, you can download the package on your system with wget command as shown.

$ wget https://downloads.plex.tv/plex-media-server/1.13.8.5395-10d48da0d/plexmediaserver-1.13.8.5395-10d48da0d.x86_64.rpm

If you’ve used install base using yum repo- you now need to install it, otherwise if you’re with RPM installation, you already have plex installed.

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.service
sudo systemctl enable plexmediaserver.service

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 --permanent
sudo 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

Now heres’ the tricky part. For some reason, plex requires the ‘localhost’ concept and opensup the post installation process through this. That means, your CentOS box needs to have a Graphical Mode installed. So, if you’re not in the GUI mode, log out from CLI and login in the GUI mode, hit the browser and type:

http://YOUR_SERVER_IP:32400/web

and you will be presented with a setup wizard, which will guide you trough the Plex configuration:

Src:
https://linuxize.com/post/how-to-install-plex-media-server-on-centos-7/#google_vignette
https://www.tecmint.com/install-plex-media-server-on-centos-7/

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.