Plex Media Server

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
368
Reaction score
423
Credits
13,526
The Plex Media Server is like a DLNA server, because it shares media from a central location. Plex requires more configuration of the media by placing them in special media folders.

Using Plex gives more information about a movie, TV series, etc. The actual difference is that you need to use a Plex client instead of any type of media player that is DLNA compatible. Plex clients are available for many platforms.

Download and Installation

Before downloading and installing the Plex package, update the Operating System (OS) and update everything properly with no missing dependencies.

To download the file for Debian or Red Hat-based Linux, go to 'https://www.plex.tv/media-server-downloads/?cat=computer&plat=linux#plex-media-server'. Here, you can download one of the following by clicking on 'Choose Distribution':


  • Fedora (27+) / CentOS (7+) / SUSE (15+) - Intel/AMD 64-bit
  • Fedora (27+) / CentOS (7+) / SUSE (15+) - Intel 32-bit
  • Ubuntu (16.04+) / Debian (8+) - Intel/AMD 64-bit
  • Ubuntu (16.04+) / Debian (8+) - Intel 32-bit
  • Ubuntu (16.04+) / Debian (8+) - ARMv8
  • Ubuntu (16.04+) / Debian (8+) - ARMv7
Once you download the file for your Distro, you should be able to go to the saved file in its folder. From a Terminal, use the command:

For Debian based:
Code:
sudo dpkg -i plexmediaserver*
For Red Hat based:
Code:
sudo rpm -i plexmediaserver*

In either case, you can replace 'plexmediaserver*' with the full filename of the downloaded file.

No matter the distro, start and enable the service:

Code:
sudo systemctl start plexmediaserver
sudo systemctl enable plexmediaserver

NOTE: Even if you started and/or enabled the service, the commands will have no effect on the settings.

Media

For Plex, you can use Video, Audio and Pictures to share with the Plex Clients. Of course, you may not have enough space on the drive with your OS, so you'll need to add drives. External drives can be a little difficult to add to the Plex Media Server.

Plex does not recognize add-on disks, such as USB drives. You must set up external drives as mounted drives or permanent drives. To fix this, you must add the drives to the File System Table (fstab).

The system sees regular external drives as devices. Usually, in the left pane of the file manager is where they list external USB devices. If ‘fstab’ includes the device, then it no longer appears as a device, but is a folder in the existing file structure.

So, let's refer to the primary drive, where the OS resides as the ‘OS drive’. On the OS drive, I'll create a folder called 'plex' as a root folder with the command:

Code:
sudo mkdir /plex

Now that we have the main folder created, we need to set up correct permissions. You can do this in a terminal as commands or set them up as a shell file to perform the commands over and over. You may add files and folders which may keep their existing permissions, so you'll need to change the permissions.

Code:
sudo chown plex:plex /plex -R
sudo chmod 766 /plex -R

The first command will change the owner of all folders and files (-R) for everything in the folder '/plex' to the user 'plex' and the group 'plex'.

The second command sets the permissions to allow all rights to the user 'plex', but limits permission to only read/write for the group 'plex' and everyone else. You can set permissions for the folder '/plex' as well as all sub-folders and files (-R).

We now need to set up folders in '/plex' to allow an external drive to mount.

Let's say we have an external drive that is labeled as 'Green'. If possible, make the file system something other than 'ntfs' or 'fat32'. It is preferable to use EXT, such as 'ext4'.

NOTE: NTFS will work, but this can make things a little more difficult, but not impossible. I'll cover it just in case. Sometimes you may have an existing drive with media files on it that are already 'ntfs'.

So, in '/plex' we can add a folder to mount the 'Green' drive to for use by Plex.

Code:
sudo mkdir /plex/seagate

The name is not mandatory, but whatever name you use, you need to remember.

Next, we need to get the Universally Unique Identifier (UUID) for the drive we want to use, in this case the Seagate drive. Use the command 'lsblk -f' to get the UUID. Figure 1 shows my example. The 'Green' UUID is '095c150e-aed0-4d07-afdc-9392a7c31c36'. You should also see that the format is 'ext4'.

Figure 1.JPG

FIGURE 1

So, we need to edit the file '/etc/fstab' with root privileges and add the following line:

UUID= 095c150e-aed0-4d07-afdc-9392a7c31c36 /plex/Green ext4 defaults 0 0

NOTE: Be sure to get all options correct. Errors can cause the system to not properly start. Here, you need to go into maintenance mode and fix the entry.

The first part is the UUID. Next is the folder where we mounted the drive (/plex/Green/). Looking at the third part is the format (ext4). The next portion is that we mount the drive with 'defaults', which is usually okay to use. You can see that the second last part is to specify about backing up, which is an outdated option, so setting the option to false or '0' is the best. The last option specifies whether to perform a system check will on the disk. Here, it is best to set as '0' unless you want the disk to be checked at boot, then set to '1'.

After saving the file, you can reboot and go to '/plex/Green' and see the contents of the drive. The drive 'Green' will not appear in the left-pane of the file manager as a device.

It is possible at this point you will need to perform the commands to set the ownership and permissions on the new drive in the folder you mounted it.

To make things a little easier, you are probably logged in as you and not 'plex'. Add your user account to the group account of 'plex' with the command:

Code:
sudo usermod -a -G plex user

Change 'user' to your username. This will add your account to the group 'plex'. After logging out and back in, the account should be changed and active.

NTFS Media

The problem with NTFS drives is that the Root has ownership and permissions and you cannot change them.

So, let's get this drive mounted first. We label the drive as Seagate. The UUID, shown in Figure 1, is '724C4BE04C4B9DAB'. So, I would add the 'fstab' line:

UUID= 724C4BE04C4B9DAB /plex/Seagate ntfs defaults 0 0

Of course, I need to create the folder '/plex/Seagate'.

If you perform the command 'ls -al' on the NTFS drive, you can see that the permissions are set to ROOT, as shown in Figure 2.

Figure 2.JPG

FIGURE 2

To make this work right, it is best to add the 'plex' user to the group 'root'. Use the command:

Code:
sudo usermod -a -G root plex

Adding Libraries

Now that we have the media set up, we can add the media to libraries for the Plex Media Server.

Keep in mind to separate the movies, TV series, photos and audio files in folders. We can use a separate folder for each type and then the various media placed in the folder. Each movie can be in a separate folder under 'movies'. Same for the TV Series which can also have sub-folders for each season. Be sure to set the permissions as discussed previously.

Open a browser on the Plex Media Server and go to the site 'https:127.0.0.1:32400/web'.

It should open a page should for the Plex Media Server as shown in Figure 3.

Figure 3.jpg

FIGURE 3

Here, you can see that there are movies to watch on-demand. These movies included on Plex will have ads unless you pay for Plex Pass.

The left-pane will include any added media, in my case the bottom three icons.

So, to add a library, click on the 'Settings' icon in the top right corner that looks like a wrench. You should now see a window similar to Figure 4.

Figure 4.jpg

FIGURE 4

Click on 'Add Library'. And you should then see Figure 5.

Figure 5.jpg

FIGURE 5

Choose your type of media for the library and click on 'Next'. You should now see Figure 6.

Figure 6.jpg

FIGURE 6

Click on 'Browse for Media Folders'. A window should appear, allowing you to search the OS Drive and find the media folder you selected. After finding it, accept the choice and add the folder to the Library. If you have a lot of files, it may take a while since the service scans the folder. You can then select the 'house' icon, as shown in Figure 3 at the upper left. You can see the icon added at the bottom left for the library you added.

If errors occur, you need to set the proper permissions and ownerships.

Conclusion

This is a basic setup and you can access the media libraries on the local network. If you allow an open port on the firewall of your router for Port 32400, you can access the media over the Internet.

Overall, this is fairly simple to implement. You are required to use the Plex Clients to access the server to get the full benefits of the media server and all the extra features. When adding a movie to the media server, you can select it and get information about the movie or show and see what actors are in it, etc.

If you need a good media server for your files, this is a great way to manage it and access it.
 
Last edited:


Oh my god, man. Thank you!

I was getting ready to pull what little hair I have left out to figure out why Plex wasn't recognizing my external media.
 

Members online


Top