Plex Remote Transcoder on Debian 8

Introduction

This is a guide how to get Plex Remote Transcoder setup on two Debian machines a master and a transcode slave. The first machine will be the master node with IP address 192.168.0.2 and the transcode slave node with IP address 192.168.0.3. This guide assumes that you have already installed the Plex Media Server (PMS) .deb package on the master (directions can be found here if needed). The slave should be a minimal install of Debian 8 . A good way to follow along if you don’t have access to multiple machines is to simply create a few virtual machines using something like VirtualBox/Proxmox/KVM/VMWare/LXC or what ever.

For this guide, we’ve installed Debian 8 on two virtual machines using Proxmox. On the master we’ve installed the latest copy of Plex Media Server (PMS), which at the time of writing is version 1.3.0.3059-6277334.

Configure the Master Node

Dependencies

First of all we need this packages to forward.

  • (maybe ca-certificates for Download)
  • zip/unzip (unzip the downloaded files)
  • python-setuptools
  • nfs-kernel-server (NFS Server)
  • sudo (or use root direct)

NOTE: The slave nodes must be able to access certain directories contained on the master node. The easiest way to go about doing this is by sharing the directories over the network. In our case, we’re going to use NFS, but if you are more comfortable with a different protocol the approach should be similar.

Install Plex Remote Transcoder

Now let’s install Plex Remote Transcoder:
First get the zip version of the Source Code and install it.

Now configure PRT 

You will be prompted for the IP address of the master node. (NOTE: This is the IP Adress where all the Slaves are connecting to the Master Node if you are using this in a non local Network you need to set the Outside IP of the Machine/Firewall (NAT)). In this example, it is 192.168.0.2. Behind the scenes this command will rename the original Plex New Transcoder to plex_transcoder and installs a new Plex New Transcoder provided by Plex Remote Transcoder.

Copy the configuration file to the plex user.

Now we need to tell the master about the transcode slave. We need to do this as the plex user, which can be accomplished via the following command.

alternative login into the plex user

which will prompt you for the slave details. For our example, the values we should enter are:

Configure Network Shares

First we edit /etc/exports which defines the network shares. For Plex Remote Transcoder to work, we need to share four things

  1. The Plex configuration directory
  2. The Plex binaries directory
  3. The temporary Plex transcoder directory
  4. Every directory that PMS looks for media in

NOTE: If you are using a NAS/SAN or a CloudDrive (ACD/GDrive) for your media it is recommended to mount the Media-Folder directly in your slaves.

The first directory is /var/lib/plexmediaserver and the second is /usr/lib/plexmediaserver. The third directory can be found/changed via Plex’s web interface. Log in, go to settings, select your server, click “Show Advanced”, click on “Transcoder” and the path will be under “Transcoder temporary directory”. In this example, I’ve set this to /opt/plex/tmp. Finally, for this example we are assuming that all media is contained in /mnt/media.

NOTE: If you also decide to use /opt/plex/tmp (or something similar) make sure the directory exists (sudo mkdir -p /opt/plex/tmp) and that it is writable (sudo chown -R plex:plex /opt/plex).

With these paths in mind, we can now create the network shares. Open /etc/exports with your favorite editor (make sure to do so as sudo) and add the following:

NOTE: Read/Write on the /var/lib/plexmediaserver you need for Mobile Sync. Read/Write on the /mnt/media you need for Media Optimization.

In these shares we explicitly told NFS to only share these with the slave (IP address 192.168.0.3).

After you’ve added this to /etc/exports, make sure to restart the NFS daemon so that the changes can take effect.

 

Configure the Slave Node

Dependencies

First of all we need this packages to forward on the Slave.

  • (maybe ca-certificates for Download)
  • zip/unzip (unzip the downloaded files)
  • python-setuptools
  • sudo (or use root direct)

Install Plex Remote Transcoder

Now it’s time to configure the slave node. Like on the master, lets start by installing PRT.
First get the zip version of the Source Code and install it.

However, there is no need to run prt install on the slave.

Add Plex User

To make permissions issues easier, it is convenient to have the same plex user on the slave as is on the master. The easiest way to go about doing this is to create a new plex user on the slave and give it the same UID and GID as the plex user on the master. To do this, execute the following on the master

which should return something like

Your numbers may be different, so write them down.

Now, back on the slave we can create the new plex user

Make sure to use the UID and GID that you wrote down in the previous step.
Now if we do id plex on the slave, we should get the same output as on the master.

Configure Network Shares

We need to tell the slave how to mount the network shares that we’ve exposed on the master. Open up /etc/fstab with and editor, as sudo, and add the following:

Notice that we’ve pointed to mounts to the master at 192.168.0.2. Also, make sure that these paths exists.

Now we can mount the shares

If you do ls /*/lib/plexmediaserver you should see files listed, these are being shared to the slave by the master and everything is working as it should.

 

Enable Key-Based Authentication

In order for this all to work the plex user on the master must be able to login to the slave without a password. The secure way to do this is via key-based authentication.

On the master, change to the plex user and generate a key

Accept the defaults and when prompted don’t add a password, just hit “return”. Now we need to copy that key from the master to the slave.

For this just

now copy the .ssh (/var/lib/plexmediaserver/.ssh) folder to the slave under /home/plex.

After that try connecting to the slave

It should say something along the lines of “the authenticity of host can’t be established”, just type “yes” and continue. If everything went as planned, you should now be logged into the slave without having supplied a password!

 

All Done

That’s it! You should now be able to fire up a video and watch it being transcoded on the slave instead of the master.

 

Uninstall

To uninstall PRT, you have a couple of options but the easiest is to simply (re)install the original PMS dpkg:

After that you need to remove the NFS Shares.
Now your Plex install should be back to normal.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.