(Tutorial) How To Install Plex in a FreeNAS 11.2 Jail

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
With FreeNAS in general, I skip permissions and get everything up running at first just to see how everything is supposed to work. Afterwards, I go and see if I can get it working with permissions.

In the case of Plex, I could never get it working properly. Just FYI
 
Joined
Mar 6, 2014
Messages
686
In the case of Plex, I could never get it working properly. Just FYI
In what case DID you get it to work? I'm asking because for Plex it's no different from other jails/plugins and a lot easier than Transmission/Sabnzb for example.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
Not sure if this is related, but I've been using Plex successfully in a jail for months and then after an update (not sure if it was FreeNAS or Plex) all my media folders suddenly appeared with ACL permissions (i.e. the + after the rwrwrwrwr stuff)

Didn't cause any issues with Plex running, but did cause problems copying new media into the folders. Easy enough to remove the ACL permissions, but I've just been doing on a folder by folder basis when I wanted to add something new.
 

TrueType

Dabbler
Joined
Mar 26, 2015
Messages
20
I have a problem with the remote access with this new update "0.9.12.8"... It aint available to reach out to the internet. I had no problem before the update...

Nothing happens when I press Disable Remote Access or when I dont use the manual port...
Anyone know what to do?
ERROR:
WTnxswyg57LfNBJv0Zu7Yn1-09IDio6cTZTzJm78gXE
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I updated from 0.9.12.3 to 8 yesterday after updating Plex iOS to v4, and had a similar issue. I restarted the jail and everything was fine.
 

TrueType

Dabbler
Joined
Mar 26, 2015
Messages
20
I got it to work!

After first closing all ports in my router, and then restarted the plex server. I somehow got it to show that it was working on port 26810 that it chose itself when I didn't use the manual port option.

Then I opened up the 32400 port again and restarted the plex server and then I chose he Manually specify port and then it worked. :)

Don't know if it will work for everyone, but worked for me.
 
Joined
Mar 6, 2014
Messages
686
I have had to use the manual port setting from the beginning to get it to work.
 

Shark88

Dabbler
Joined
Feb 13, 2014
Messages
19
I followed the guide of the first page in order to copy my plexdata from an old jail into a new one. I installed Plex in the new jail also with the plugin system provided by freenas.

I copied the folder var/db/plexdata/Plex Media Server/ from the old to the new jail. The libraries are loaded and everything plays fine. Unfortunately, 95% of the posters of movies and tv shows are missing. Even a force refresh does not bring them back. If I go to a single item and go to the edit panel, the posters show up and I can click on the first one to have it appear for the item.

But since I would have to do this for every item over and over again, thats not an option. Any idea how to resolve this? I already deleted the Chaches in Plug-in Support/Caches, but the issue is still present?

Thanks a lot!
 
Joined
Mar 6, 2014
Messages
686
Why on earth would you copy your media to another jail??? Your media should be stored in just one place, not in the jail, but shared with the jail
 

Shark88

Dabbler
Joined
Feb 13, 2014
Messages
19
Who said something about the media? The media files are stored at one place, which I just mounted into the jail!

The copied directory should include the database and settings.
 
Joined
Mar 6, 2014
Messages
686
Who said something about the media? The media files are stored at one place, which I just mounted into the jail!

The copied directory should include the database and settings.
Ah sorry, I misread the path! Well, nowadays the plug-in is so much improved that I started using that instead of the separate jail. It's very very stable and easy to update. When I switched, I just let it rebuild the media database once and now the plug-in update works like a charm
 

Cosmo_Kramer

Contributor
Joined
Jan 9, 2013
Messages
103
You followed all exact steps after fresh install?
Code:
pkg update && pkg upgrade
portsnap fetch extract (or portsnap fetch update if this is not the first time updating ports)
cd /usr/ports/ports-mgmt/portupgrade/ && make install clean


I just did all of this in a fresh jail to test (latest 9.3) and everything works fine for me (accepting all default values)
This is now included in the tutorial. I also converted the whole tutorial to use pkgs instead of ports.
 
Joined
Mar 6, 2014
Messages
686

EvanVanVan

Patron
Joined
Feb 1, 2014
Messages
211
This is now included in the tutorial. I also converted the whole tutorial to use pkgs instead of ports.
Cool, thanks. I don't know what the benefit of packages over ports are but I did just see packages mentioned on the plex forum this morning.

I've been meaning to reply to this thread and ask for a favor for a while but I didn't know if you still followed it... Would you mind putting
Code:
service plexmediaserver_plexpass restart

somewhere in the first post? I can never remember what the name of the plexpass version of the service is called and always have to go searching through a few pages before I find it. Even just as a footnote at the very bottom of the post would be very helpful.

Thanks
 

Cosmo_Kramer

Contributor
Joined
Jan 9, 2013
Messages
103
Cool, thanks. I don't know what the benefit of packages over ports are but I did just see packages mentioned on the plex forum this morning.

I've been meaning to reply to this thread and ask for a favor for a while but I didn't know if you still followed it... Would you mind putting
Code:
service plexmediaserver_plexpass restart

somewhere in the first post? I can never remember what the name of the plexpass version of the service is called and always have to go searching through a few pages before I find it. Even just as a footnote at the very bottom of the post would be very helpful.

Thanks
Hi Evan,
The main benefit to packages is that you don't have to compile them like you do with ports. So this makes it much faster to update while limiting possible failure points during the installation.
Good point on the Plex Pass version. I will try to remember to write a part of the guide dedicated to that version this weekend.
 

JJT211

Patron
Joined
Jul 4, 2014
Messages
323
Could not stop service for some reason but this is how I updated using the new method

jls
jexec # tcsh
pkg update && pkg upgrade multimedia/plexmediaserver-plexpass
service plexmediaserver_plexpass restart

Thats it!

And I agree, its much easier and faster
 
Last edited:
Joined
Apr 9, 2015
Messages
1,258
Not extremely active poster but lurk quite a bit.

Anyway one of the problems I have had due to not trusting UPNP is that every time I restart FreeNAS or the Plex jail I lose remote connectivity. I could go into the plex web interface and modify the server settings in advanced mode and check the box to manually specify the port and it would work perfectly. I already have the forward set up in my router so the web interface is always available but the application would fail remotely. But if you do an upgrade or update and forget to reenable the manual port forwarding then go out and try and access the server it will fail. So I was poking around and figure out how to get it to work automatically. I installed via PKG so if you did a port install your location of Preferences.xml may be different.

Edit the file:

/usr/local/plexdata/Plex Media Server/Preferences.xml (btw if you want to do this without changing to the exact directory first remember to put the line in " " or it will mess up)

You will find two lines and at the very end of the second line which is VERY long you will find :

LastAutomaticMappedPort="0"

Remove it or before it insert two things:

ManualPortMappingMode="1" ManualPortMappingPort="32400"

Restart plex or restart the jail and you MAY have to tell it to disable access and re enable access and do another restart but it will finally read the file information and give you a message in plex of:

You currently have Remote Access enabled through a manually-specified port. If you wish to disable Remote Access, you will need to remove your manual port forwarding from your router.

But it now survives a FreeNAS, Jail or service restart.
 

EvanVanVan

Patron
Joined
Feb 1, 2014
Messages
211
I just tried updating to the latest version (this is my second time updating via the package method, absolutely it is much faster and easier), it seemed to succeed. I had to acknowledge updating the package from (1.5.4 -> 1.6.1), or something**. But when I refreshed the Plex Server settings page, the server version is still showing up as V 0.9.12.12 instead of 0.9.12.13(.1464) that the freshports lists as the latest version. I've stopped/started/restarted the Plex service via shell numerous times with not fix.

Any ideas?

Thanks
 
Joined
Apr 9, 2015
Messages
1,258
More than likely the latest version in the package is .12 The ports versions will be later and the latest version will be the one released directly from plex but each of these will be more difficult to install, update and manage than the package version. The revisions you are seeing are VERY minor anyway and more often than not will be spelling errors or very minor bugs that are likely to go unnoticed anyway. Start worrying when it's been a month and the revision jumps from .9.12.12 to something like .9.7.25 or even 1.2.3.4

Also the PlexPass version seems to be a little newer release than the regular version.
 

dedeaux

Dabbler
Joined
Jun 16, 2015
Messages
34
What is the advantage of doing Plex Server this way as opposed to using the Plex plugin route via the GUI?

I notice in freshports that there is also a plexmediaserver-plexpass pkg as well -- what is the advantage of using that over plexmediaserver?

Finally, having gone the route of installing the Plex plugin, would there be a migration path to this method aside from deleting the pluging/jail and starting over?

How To Install Plex in a FreeNAS 9.3 Jail:

First off, navigate to your FreeNAS WebUI in your browser.

Next, click on the "Jails" button on the top bar, and then click on the "Configuration" tab.

From there, select a "Jail Root" that is suitable to where you want your jails to be stored. Then click on "Advanced Mode" to expose the network settings. Then fill in the network settings to match your environment. Then click on "Save".

Next, click on the "Jails" tab and then click on the "Add Jails" button.
From there, a window will popup with options to configure your jail. Click on "Advanced Mode".

Then select the following options:
Jail Name: plex
IPv4 Address: 192.168.x.x (Anything that isn't taken and isn't in your DHCP scope)
Autostart: Checked (default)
VIMAGE: Checked (default)


Then click "Ok".
For more information on creating jails in FreeNAS, visit: http://doc.freenas.org/index.php/Adding_Jails


Once the jail is created, navigate to a shell prompt, either through the FreeNAS WebUI Shell or via SSH.
Once at a shell prompt, view the currently installed jails with the following command:

jls

You should see something like this:

Code:
JID  IP Address      Hostname                      Path
1    -               plex                          /mnt/Jails/plex


In this case, the plex jail has a JID of 1, so to get a shell prompt in the jail, use the following command:
jexec 1 tcsh

Next, to update the jail's packages, run the following command:
pkg update && pkg upgrade -y

Now, to install Plex, run the following command:
pkg install multimedia/plexmediaserver

Once that is complete, you need to setup Plex to start automatically when the jail starts with the following command:
echo plexmediaserver_enable="YES" >> /etc/rc.conf

Next, start Plex with the following command:
service plexmediaserver start

Plex is now ready to use and you can navigate to it with this URL:
http://192.168.x.x:32400/web

Once you tie a Plex account with your server, you will be able to access Plex internally and externally via:
https://plex.tv/web



Accessing Mounted Storage In Your Jail With Plex:
To add storage to your FreeNAS Jail, start by following this documentation:http://doc.freenas.org/index.php/Adding_Jails#Adding_Storage

After mounting the storage in your jail, it may be tempting to grant your files 777 access to give Plex access to them. With that said, don’t do it; there is an easy work around. Basically, you can add groups to the jail with the same GroupID as the ones on the host system.

Once at a shell prompt within the jail, find out what the GroupID is of the group that is assigned permissions on the mount with this command:
ls -l /mnt

You’ll then see a list of mount points such as this one:
Code:
drwxrwx---+ 7 1002 1001 8 Mar 3 18:35 Media


The column with 1002 is the UserID, and 1001 is the GroupID. If you want Plex to have access to the Media mount, you need need to create the Media group in the jail with a GroupID of 1001, and have the plex user in it.

To do this, run the following command (where 1001 is the GroupID):
pw groupadd Media -g 1001 && pw usermod plex -G Media

After running the command, you can look at the permissions of the mount again by using:
ls -l /mnt

Now, you should see the following instead:
Code:
drwxrwx---+  4 root  Media   4 Feb 21  2014 Media


Finally, restart Plex:
service plexmediaserver restart

You are now done. Plex will now have access to the Media mount.


Upgrading Plex:

When new releases of Plex come out, you may update without losing your data and preferences. To check if a new release of Plex is available, visit this page:
http://www.freshports.org/multimedia/plexmediaserver/

First off, stop Plex with the following command:
service plexmediaserver stop

To actually update Plex, run the following command:
pkg update && pkg upgrade multimedia/plexmediaserver

Lastly, start Plex again with the following command:
service plexmediaserver start
 
Top