Skip to content
Admin9705 edited this page Feb 19, 2019 · 112 revisions

📂 Click Here - Sign up for Google's Suite for Business - Unlimited Space

📂 Click Here - NZB's with from NewsHost - PG Members Receive a 58% Discount

Table of Contents

  1. Intro
  2. Access Information
  3. Installing Plex
    1. Plex Local Edition
    2. Plex Remote Edition
  4. Configuring Plex
    1. Remote Access
    2. Accessing Content
    3. Optimization
  5. Configuring Hardware encoding
    1. Background and quick check
    2. CPU support for HW encoding info
    3. Host driver setup and install
  6. Summary

1. Intro

Plex... the main reason we are. Easy to set up? Ya. Complications at times? Ya. So "what does Plex do for me" you ask? Think of Plex as having your own version of Netflix, but rather through the files that you already own. Plex can be addictive, which is why we are both here. Starting off with a simple collection is rather satisfying, but then you start realizing that you're running out of drive space, running RAIDs, and now trying to push things to the cloud (or not). You're not contempt with the basic streaming services and the cable company has you boxed in! That's where Plex come into play! Before executing Plex, you have conducted some basic planning. Is the server powerful enough, how much disk space is available, and how can the server be cost effective for one's needs?

Demo Example of Running a Plex Server

2. Access Information

Protocol Address Notes
traefik** plex:32400 Only for Internal App-to-App Communication
https plex.domain.com Traefik must be Deployed; Remote Servers
http domain.com:32400 Poor Security Practice - Stop with PG Port Guard
http ipv4:32400 Ideal Only for Local Servers

** Ideal for Apps to communicate between with one another. Click Here for more info!

3. Installing Plex

Welcome to the crossroads! When executing Plex to install, you will be presented with a question in order to install either the remote or local edition. This part is important because it will affect in how you will be able to claim your Plex Server. If you select the local edition, you will easily be able to claim your Plex Server, whereas the remote setup will allow you to claim your Plex Server through an IP address. So please, select the correct one!

I. Plex Local Edition

Installing the Plex Local Edition is simple. Once installed, you will see the following message.

Plex Local Edition

Here, you will simply visit your local IP address and you should see Plex asking for you to login. Once logged in and your able to claim your server, you are pretty much good to go! If your intent is to share out your server or utilize your server beyond the range of your home (or that of your local server), make sure to turn on your remote access. If you are unable to see your server outside of your local location, pay attention to tips provided. Anything beyond that, please visit our forums or the Plex Forums to resolve your issue.

II. Plex Remote Edition

a. PG YouTube: Remote Setup

Plex Remote Setup

b. Remote Setup Info

Installing the Plex Remote Edition is a-bit more involved, but easy to do if you follow the provided steps. Before Plex Deploys, you will see a screen that will ask about your Plex ID. Visit https://plex.tv/claim and claim your Plex Server Code and paste and press enter within the terminal window.

Plex Claim Ask - Terminal

Now that you entered your code, PG will prompt you with some more information. You will need to visit: IP Address:32400/web. Do not forget the /web (if you do, you may see some Plex XML garbage and will start to ponder how to ask us a 1000 different ways to access your server).

Ensure to follow the steps as listed to ensure that your able to access your server. It is recommended that if you are having issues, test out with a second device and see if you can access PLEX. Personally, it has been witnessed that PLEX will say your server is not able to get out and then with your phone, you can see it.

4. Configuring Plex

This is the fun part! We'll tackle this portion in two ways. First, we will configure Plex to access your content and then the second part will be in regards to optimization.

I. Remote Access

You can safely disable plex's built in remote access and still access it via your plex.domain.com Disable remote access:

Then under network settings, click show advanced at the top. Then add your plex domain

II. Accessing Content

In the use of all PlexGuide editions, you will access your content as shown below. The best recommendation I can tell you is not to select your location, but rather type it. Here are some examples below:

Type it, do not select it

  • /mnt/unionfs/tv
  • /mnt/unionfs/movies
  • /mnt/unionfs/mycustomcategory

Type it, do not select it

Press [ENTER] and it will come up!

III. Optimization

  • Configure what you need, there is one important area.
  • [Click] Server > Show Advanced > Library
  • [Turn On] Update my library automatically
  • [Keep-Off] Run a partical scan...
  • [Keep-On] Include music libraries...
  • [Keep-On/Off] Update my library periodically (your choice..off if you have update automatically)
  • [Select] Library update interval: Every hour (for huge libraries, every 2 is better)
  • [Keep-On] Empty trash automatically after every scan
  • [Click] Server > Show Advanced > Scheduled Tasks
  • [Turn/Keep On] Backup database every 3 days
  • [Turn/Keep On] Optimize database every week
  • [Turn/Keep On] Remove old bundles every week
  • [Turn/Keep On] Remove old cache files every week
  • [Turn/Keep On] Refresh metadata periodically
  • All the Rest; keep unchecked.

5. Configuring Hardware Encoding

NOTE: You MUST have Plex Pass to enable hardware transcoding in the Plex server. See Using Hardware-Accelerated Streaming from the Plex site.


Background/quick check:

This assumes your server has a CPU with iGPU or GPU that can do hardware transcoding. If you do, and the drivers are already installed, then the fix to get it working inside the Plex Docker container isn't too difficult.

Bottom line up front: If the hardware and drivers aren't installed on the host, it won't work inside the Docker container. If they are, I'll show you how to ensure they're available inside the Docker container as well.

You can do a quick check to see if the drivers are already installed by "ls -la /dev/dri"; you should see something for "card0" and "renderD128" if they are. --If you have multiple GPUs, including an integrated (iGPU) and a discrete (i.e. nVidia or AMD) you'll probably see additional files labeled "card1" and "renderD129". This won't matter, but we also will only use one card. If the driver files don't exist you'll likely get an error saying the directory doesn't exist, or maybe drivers for other non-GPU/iGPU devices. That's fine - the "Host Install" sections will show you how to "activate" them. If they are, and you're sure, you can skip the next part in between the dashed lines and move to how to enable inside the Docker container.


CPU support info

Does my Intel CPU include an iGPU capable of Quick Sync?

Most "desktop" class CPUs from Intel starting with the second series (i.e. "Sandy Bridge" or the 2500/2600 CPUs) have an iGPU that is capable of at least h264 hardware transcoding.

  • The Sandy Bridge (2xxx series) through Haswell (4xxx) series don't have great quality when hardware transcoding h264 - but they do work.

  • Skylake (6xxx) and higher will even do h265/HEVC.

  • Kaby Lake (7xxx) and higher will do h265/HEVC with HDR/10bit video.

Skylake and higher look GREAT when using hardware encoding - virtually indistinguishable in quality from CPU encodes, but with 5% of the CPU usage.

I have a Xeon - will it work? Some Xeons do have iGPUs. Notably those that end in a "5" or "6".

How can I confirm? Fast check: Intel's Quick Sync capable CPU search page Search for your CPU.

or

Wikipedia's table for Intel Quick Sync hardware encoding and decoding by Intel family For example, using a Xeon E5-1650v3. Look for the E5-1650v3 series. This is a "Haswell" class CPU, but it was sold as a workstation CPU so note there is no "Graphics Clock Rate" column, because they didn't have iGPUs. (They also didn't come with heatsinks, as the users were expected to add discrete GPUs and their own heatsink.)


Host Install

(Specific instructions and examples below are for a Hetzner dedicated server however much is useful for others as a guide):

For Hetzner server users, the following is how to get the drivers and capability installed on the Linux host.

  • Comment out all line referencing i915 in this file: /etc/modprobe.d/blacklist-hetzner.conf

    • sudo nano /etc/modprobe.d/blacklist-hetzner.conf
    • Add a # in front of the lines "blacklist i915" and "blacklist i915_bdw"
    • # blacklist i915
    • # blacklist i915_bdw
  • Remove Hetzner's default grub config "nomodeset" which blocks loading of video card drivers:

    • Ubuntu 16 or earlier: nano /etc/default/grub.d/hetzner.cfg or
    • Ubuntu 18.04 or later: nano /etc/default/grub
    • comment out GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" (it's okay if it also has consoleblank=0 at the end."
    • # GRUB_CMDLINE_LINUX_DEFAULT="nomodeset consoleblank=0"
  • Update and Reload grub.

    • sudo update-grub
    • For older Ubuntu try sudo grub-mkconfig -o /boot/grub/grub.cfg
  • Add user root (or whoever is the user running the Plex service) to the video group:

    • sudo usermod -a -G video root
  • Reboot the server

  • Try ls -la /dev/dri now it should find the folder and list drivers

  • Type chmod -R 777 /dev/dri to change permissions (critical step for use in Docker!)

  • I recommend installing and running vainfo and ensure it gives you a positive readout on your driver

    • sudo apt update
    • sudo apt install vainfo
    • vainfo
      • You want a line similar to "vainfo: Driver version: Intel i965 driver for Intel(R) Haswell Server - 1.7.0" somewhere in the 18-20 lines it puts out.

Note: If VAINFO works, it's almost a sure bet you'll be able to get the Docker Plex to work. However, as long as the /dev/dri folder with the two driver files are there, you're probably okay even if running VAINFO throws an error.


Getting it working (optimally) inside Docker.

The following updates to the Plex Docker container are not strictly necessary - but recommended.

You'll need to run the following commands from the HOST (to make it easier for you):

  • docker exec plex apt-get -y update
  • docker exec plex apt-get -y install i965-va-driver vainfo
  • docker restart plex

That updates the driver now that it can get to the files outside the container.


Additional tips/tricks:

The following command should give a succinct info read on your iGPU:

GPU=$(lspci | grep VGA | cut -d ":" -f3);RAM=$(cardid=$(lspci | grep VGA |cut -d " " -f1);lspci -v -s $cardid | grep " prefetchable"| cut -d "=" -f2);echo $GPU $RAM

For example, on one of the dedicated servers I use (an Intel Xeon E3-1246V3), the output is: Intel Corporation Xeon E3-1200 v3 Processor Integrated Graphics Controller (rev 06) 256M

However on a non-dedicated VPS I use the output is: Cirrus Logic GD 5446 32M (Yeah...the emulated Cirrus Logic isn't going to work for hardware encoding.)

6. Summary

Keep in mind to monitor your Plex Server at times. Ensure that you always have enough diskspace for transcoding and keep in mind that if your server is distant, many of your issues can be related to one common medium known as the Internet (slow downs along the way). Best of Luck!

Installing PlexGuide

  1. PlexGuide Install Information

Preplanning & Information

  1. PG Folder Structure

Domain and Port Control

  1. CloudFlare Tunnel

Primary Applications

  1. Plex

Useful Links

  1. PG YouTube Channel
Clone this wiki locally