-
Notifications
You must be signed in to change notification settings - Fork 58
Debian 8.x Install
This is a guide 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 vanilla install of Debian 8.6 . 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 (take a look at this tutorial for a quick way to get started).
For this guide, we've installed Debian 8.6 on two virtual machines using VirtualBox. 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
.
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 themaster
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.
apt-get update
apt-get install ca-certificates zip unzip python-setuptools nfs-kernel-server sudo -y
Now let's install Plex Remote Transcoder:
Get the zip version of the Source Code. (https://github.com/wnielson/Plex-Remote-Transcoder/releases/latest)
wget https://github.com/wnielson/Plex-Remote-Transcoder/archive/X.X.X.zip
unzip *.*.*.zip
cd Plex-Remote-Transcoder
sudo python setup.py install
Now we need to configure Plex Remote Transcoder
via the prt
command that was installed in the previous step
sudo prt install
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_trancoder
and install a new Plex New Transcoder
provided by Plex Remote Transcoder
.
Set up the configuration with
sudo install -o plex -g plex ~/.prt.conf ~plex/
which will copy the configuration file into the plex
user's home directory and update its permissions.
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
sudo -u plex -H prt add_host
alternative login into the plex user
su plex
prt add_host
which will prompt you for the slave
details. For our example, the values we should enter are
Host: 192.168.0.3 (IP Adress of the Slave/SSH IP)
Port: 22 (SSH Port on the Slave)
User: plex (SSH User on the Slave)
That does it for Plex Remote Transcoder
.
First we edit /etc/exports
which defines the network shares. For Plex Remote Transcoder to work, we need to share four things
- The Plex configuration directory
- The Plex binaries directory
- The temporary Plex transcoder directory
- Every directory that
PMS
looks for media in
NOTE: If you are using a NAS/SAN or a CloudDrive 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
.
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:
/var/lib/plexmediaserver 192.168.0.3(rw,sync,no_subtree_check)
/usr/lib/plexmediaserver 192.168.0.3(ro,sync,no_subtree_check)
/opt/plex/tmp 192.168.0.3(rw,sync,no_subtree_check)
/mnt/media 192.168.0.3(rw,sync,no_subtree_check)
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.
sudo service nfs-kernel-server restart
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)
apt-get install ca-certificates zip unzip python-setuptools sudo
Now it is time to configure the slave
node. Like on the master
, lets start by installing Plex Remote Transcoder
Get the zip version of the Source Code. (https://github.com/wnielson/Plex-Remote-Transcoder/releases/latest)
wget https://github.com/wnielson/Plex-Remote-Transcoder/archive/X.X.X.zip
unzip *.*.*.zip
cd Plex-Remote-Transcoder
sudo python setup.py install
However, there is no need to run prt install
on the slave
.
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
id plex
which should return something like
uid=105(plex) gid=112(plex) groups=112(plex)
Your numbers may be different, so write them down.
Now, back on the slave
we can create the new plex
user
sudo addgroup --gid 112 plex
sudo adduser --uid 105 --gid 112 plex --home /home/plex
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
.
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:
192.168.0.2:/var/lib/plexmediaserver /var/lib/plexmediaserver nfs rw 0 0
192.168.0.2:/usr/lib/plexmediaserver /usr/lib/plexmediaserver nfs ro 0 0
192.168.0.2:/opt/plex/tmp /opt/plex/tmp nfs rw 0 0
192.168.0.2:/mnt/media /mnt/media nfs rw 0 0
Notice that we've pointed to mounts to the master
at 192.168.0.2
. Also, make sure that these paths exists
sudo mkdir -p /var/lib/plexmediaserver
sudo mkdir -p /usr/lib/plexmediaserver
sudo mkdir -p /opt/plex/tmp
sudo mkdir -p /mnt/media
Now we can mount the shares
sudo mount -a
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.
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
su plex
ssh-keygen
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
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
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!
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
.
To uninstall PRT
, you have a couple of options but the easiest is to simply (re)install the original PMS
dpkg
:
sudo dpkg -i plexmediaserver_*.deb
After that you need to remove the NFS Shares.
Now your Plex install should be back to normal.