How to Install PlexConnect (with automatic boot)
Login to your FreeNAS server using the normal ip. Then go to the jails section in the navigation bar and then add jails. Select the following options:
You can give it any IP you prefer. Also make sure you select the following:
Then Click ok!
Next go ahead and open putty (or something similar) and connect directly to your FreeNAS’s IP. Username: root Password: [your password]
First we need to find the jail we just created. Run the following command:
This will return a list of all your current jails:
To get into the jail run the following command
Where <JID> is the JID of the PlexConnect jail.
Install the required software:
First we are going to have to install all the extra packages PlexConnect requires to work.
1.Pkg manager.
First let’s do some future proofing. Now pkg_add can be used instead of this method. But everyone seems to have a massive problem with it so lets us pkgng, BUT since it is not as standard part of a pluginjail (or is depending on the version of freenas you are running) we need to install it.
Run:
(Note if this is not working skip to the next package)
So then run the command:
This will take several minutes just be patient. Now for good measure you can just run:
If it want you to update the pkg manager just say yes.
2.Python
3.Nano – Text editing
4.Bash
5.Git
6.Pillow
Part 1: Get PlexConnect and Configure it
Get PlexConnect
Now we have to fetch the newest PlexConnect from the git repo.
Generate the required SSL certificates
Next we need to create the communication certificates. Change directory to the certificates folder
Generate the required SSL certificates
This will create 2 files trailers.key and trailers.pem. Next run this:
Create the Settings.cfg file
Go back to the root directory:
Change Directory
Start PlexConnect so it creates Settings.cfg
When it started Exit using CTRL + C
Change the 2 lines below
Test that the basics work:
To start PlexConnect
Make sure it starts up:
It should return that it is running. Then you can stop the process:
Part 2: Creating Boot Script
Initial Setup:
Creat the boot script
copy and paste the following code and then save and close the file.
NOTE: if you installed PlexConnect in a different directory change the directory to the bash script.
Next make sure the permissions are the same as the other scripts, run the following script:
Register the script:
Run the following command to open the rc.conf file:
and add the following line:
save and close the file.
Check that the script works:
so when you are in the root dir and you call:
and then calling:
and it returns:
so great the script works.
Now just run:
So we make sure plex is not running before we try to start it as a service.
Setup the plexconnect service:
FINALLY:
run the following command:
and it should return:
Okay great the service is now working. Thank god. Now just startup plexconnect:
So plexconnect is now running and it is a valid service. Yay.
You can then test if it is working by either rebooting your NAS or toggling the plugins on off switch.
FINAL NOTE:
Update: 2015-05-04 - Changed Boot script to now include the path parameter. Hence you no longer need to edit the bash script. (Thanks @mbaltaks)
Updated: 2015-05-04 - Added the native package manger install procedure for pillow. (also @mbaltaks)
Login to your FreeNAS server using the normal ip. Then go to the jails section in the navigation bar and then add jails. Select the following options:

You can give it any IP you prefer. Also make sure you select the following:

Then Click ok!
Next go ahead and open putty (or something similar) and connect directly to your FreeNAS’s IP. Username: root Password: [your password]
First we need to find the jail we just created. Run the following command:
Code:
jls

Now you want to directly connect to the jail itself using the JID. From the list you look for the hostname PlexConnect (I will be using PlexConnect_test as I don’t want to change my current setup, you should use PlexConnect jail.)
To get into the jail run the following command
Code:
jexec <JID> csh
Where <JID> is the JID of the PlexConnect jail.
Install the required software:
First we are going to have to install all the extra packages PlexConnect requires to work.
1.Pkg manager.
First let’s do some future proofing. Now pkg_add can be used instead of this method. But everyone seems to have a massive problem with it so lets us pkgng, BUT since it is not as standard part of a pluginjail (or is depending on the version of freenas you are running) we need to install it.
Run:
Code:
pkg_add -r pkg
(Note if this is not working skip to the next package)
So then run the command:
Code:
pkg2ng
This will take several minutes just be patient. Now for good measure you can just run:
Code:
pkg update
If it want you to update the pkg manager just say yes.
2.Python
Code:
pkg install python
3.Nano – Text editing
Code:
pkg install nano
Code:
pkg install bash
5.Git
Code:
pkg install git
6.Pillow
Code:
pkg install py27-pillow
Part 1: Get PlexConnect and Configure it
Get PlexConnect
Now we have to fetch the newest PlexConnect from the git repo.
Code:
git clone https://github.com/iBaa/PlexConnect.git cd PlexConnect/ git pull
Generate the required SSL certificates
Next we need to create the communication certificates. Change directory to the certificates folder
Code:
cd /PlexConnect/assets/certificates
Generate the required SSL certificates
Code:
openssl req -new -nodes -newkey rsa:2048 -out trailers.pem -keyout trailers.key -x509 -days 7300 -subj "/C=US/CN=trailers.apple.com"
This will create 2 files trailers.key and trailers.pem. Next run this:
Code:
openssl x509 -in trailers.pem -outform der -out trailers.cer && cat trailers.key >> trailers.pem
Create the Settings.cfg file
Go back to the root directory:
Code:
cd /
Change Directory
Code:
cd PlexConnect/
Start PlexConnect so it creates Settings.cfg
Code:
./PlexConnect.py
When it started Exit using CTRL + C
Code:
nano Settings.cfg
Change the 2 lines below
Code:
ip_pms = 10.0.0.30 # This one you have to change to your Jail IP address enable_plexgdm = False # This one you have to change from True to False
Test that the basics work:
To start PlexConnect
Code:
bash /PlexConnect/PlexConnect_daemon.bash start
Make sure it starts up:
Code:
bash /PlexConnect/PlexConnect_daemon.bash status
It should return that it is running. Then you can stop the process:
Code:
bash /PlexConnect/PlexConnect_daemon.bash stop
Part 2: Creating Boot Script
Initial Setup:
Creat the boot script
Code:
nano /etc/rc.d/plexconnect
copy and paste the following code and then save and close the file.
Code:
#!/bin/sh # #PROVIDE: PlexConnect #REQUIRE: DAEMON #KEYWORD: shutdown . /etc/rc.subr name=plexconnect rcvar=plexconnect_enable start_cmd="${name}_start" stop_cmd="${name}_stop" status_cmd="${name}_status" extra_commands="status" PATH=/usr/local/bin:${PATH} plexconnect_start() { /usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash start } plexconnect_stop() { /usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash stop } plexconnect_status() { /usr/local/bin/bash /PlexConnect/PlexConnect_daemon.bash status } load_rc_config $name run_rc_command "$1"
NOTE: if you installed PlexConnect in a different directory change the directory to the bash script.
Next make sure the permissions are the same as the other scripts, run the following script:
Code:
chmod 0555 /etc/rc.d/plexconnect
Register the script:
Run the following command to open the rc.conf file:
Code:
nano /etc/rc.conf
and add the following line:
Code:
plexconnect_enable="Yes"
save and close the file.
Check that the script works:
so when you are in the root dir and you call:
Code:
/etc/rc.d/plexconnect start
and then calling:
Code:
/etc/rc.d/plexconnect status
and it returns:
Code:
PlexConnect is running
so great the script works.
Now just run:
Code:
/etc/rc.d/plexconnect stop
So we make sure plex is not running before we try to start it as a service.
Setup the plexconnect service:
FINALLY:
run the following command:
Code:
service plexconnect status
and it should return:
Code:
PlexConnect is not running
Okay great the service is now working. Thank god. Now just startup plexconnect:
Code:
service plexconnect start
So plexconnect is now running and it is a valid service. Yay.
You can then test if it is working by either rebooting your NAS or toggling the plugins on off switch.
FINAL NOTE:
Update: 2015-05-04 - Changed Boot script to now include the path parameter. Hence you no longer need to edit the bash script. (Thanks @mbaltaks)
Updated: 2015-05-04 - Added the native package manger install procedure for pillow. (also @mbaltaks)
--++00DONE00++--
Attachments
Last edited: