Scripted installation of Plex Media Server

Your base FreeNAS system doesn’t have a user for Plex, which means that assigning permissions will be tricky. Your best bet is to create one, with a username of plex and a user ID of 972. Then you can add permissions for that user to write to your media dataset, rather than @everyone.

Good idea. I’ve added this:

Note that if the script creates $PLEX_CONFIG_PATH, it will create it as a directory, not as a dataset. This means that it will not appear in, e.g., the Storage section of the FreeNAS GUI, where you could easily see how much space it’s using, compression ratio, etc. If you want these capabilities, you should create the dataset before running the script, and then ensure that $PLEX_CONFIG_PATH is set appropriately.

Hi, I am reading though the script, as I like to understand them before I use them, and have a couple of questions, which I hope you can answer.

  1. The command to create the Jail (line 166) has ${DEVFS_RULESET} on it. I understand the rest but not sure what this is, can you expand my knowledge please by explaining it.

  2. I think I understand that lines 195 & 198 set the Plex MetaData directory to /config, which is where you mount the dataset holding this data, is that right?

  3. Not sure what the directory /configs is used for, can you explain?

  4. The package plexmediaserver_plexpass used to be for Plex Pass users for their additional features, has this now merged into the plexmediaserver package with the plexmediaserver_plexpass just being used as a BETA now?


This is used with the hardware transcode setup.

Correct, though whether it’s a dataset or a directory is up to the user.

It’s used temporarily for files that need to be copied into the jail–pkg.conf and the package update script.

Yes. The “normal” package provides the PlexPass features if you’re signed in to a PlexPass account, and doesn’t if you aren’t. The “Plexpass” package now acts as a beta. It gives early access to some new features (at least at times), but isn’t as stable.

1 Like

Dan, thanks for the clarifications.


Sorry Dan, another couple of questions for you. I seem to remember that Plex said to use Ports on FreeBSD to install the server, has this now changed to using pkg? Can’t see anything on the not-so-helpful support page.

As I want to move my old Plex metadata do I copy it to the new metadata location before or after running the script? And do I do it before accessing the 32400/web page?


I don’t remember ever seeing that, and I don’t see any reason to make this recommendation–other than that the port might be slightly more up-to-date.

I’d say before running the script would be best, though I don’t think there’s a strong argument either way.

No problems, I could swear I read it somewhere :), but pkg works just as well.

Will test this out tomorrow, thanks for putting up with my questions.


All working, thanks Dan!

1 Like

I followed the directions, created plex-config:


I put the shell script and the plex-config in the same folder and ran the script. It went off and did it’s thing and I went away and did something else for a while. When I came back, there were no errors, but the shell window of the web GUI did not seem to have any indication I had just done something.
I can see that there is a jail called pms with Release = 11.3-RELEASE-p10.
There are two mount points:

Source: /mnt/Pool.1-3TB/plex_data, Destination: /mnt/Pool.1-3TB/iocage/jails/pms/root/config


Source: /mnt/Pool.1-3TB/Media, Destination: /mnt/Pool.1-3TB/iocage/jails/pms/root/media

Under Storage, I see my pool structure.
Plex Pool
Which looks sort of like I would expect it to (if I knew what to expect).
On my router I can see that the IP address is in use and I can ping it.
When I go to

I get nothing. The script instructions say to log in and configure my media server, but how to do that is left as an exercise to the interested reader.

Bottom line: I can’t tell if plex is running or not.



Go to the Jails page in the GUI. See if the Plex jail is there (it will be called pms for Plex Media Server), and if it’s running.

Hi Dan, thanks for chiming in here.

Plex appears to be running. I have restarted it to no avail. EDIT drops a comprehensive menu of things I could change if I understood them.

I scanned that Ip address and 32400 is not open, nor are any of the other Plex ports. I can ping it though.

Everything I read indicates it should “just work” but there is something crucial I am missing here.

I there a guide on how to back out what I have done and re-do or follow another way of getting Plex working?

I apologize; I apparently let this slip through the cracks. So the Plex jail is running, but it kind of looks like Plex itself isn’t running. Let’s test that. From the FreeNAS shell, run iocage console pms, and once that loads, service plexmediaserver status. If it says it is not running, try starting it with service plexmediaserver start.

1 Like

No apology necessary. I appreciate the help. So, hmmm…

root@pms:~ # service plexmediaserver status
plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

I knew this command was doomed to failure, but I couldn’t help myself.

root@pms:~ # service plexmediaserver start
plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

So I went looking and indeed plexmediaserver does not exist in /etc/rc.d or /usr/local/etc/rc.d – it’s not a matter of executability, it’t not there. Maybe I should delete the jail (how?) and start over.
Other suggestions welcome. Thanks!

That does suggest something’s gone very badly wrong with the script. Just for kicks, what happens if you run (in the jail) pkg install plexmediaserver?

This is copy/paste overkill but the output is instructive:

root@pms:~ # pkg install plexmediaserver
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+, please wait…
Verifying signature with trusted certificate… done
[pms] Installing pkg-1.14.6…
[pms] Extracting pkg-1.14.6: 100%
Updating FreeBSD repository catalogue…
[pms] Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
[pms] Fetching packagesite.txz: 100% 6 MiB 627.5kB/s 00:10
[pms] Extracting pkg-1.14.6: 100%
Updating FreeBSD repository catalogue…
[pms] Fetching meta.conf: 100% 163 B 0.2kB/s 00:01
[pms] Fetching packagesite.txz: 100% 6 MiB 627.5kB/s 00:10
Processing entries: 100%
FreeBSD repository update completed. 30836 packages processed.
All repositories are up to date.
Updating database digests format: 100%
The following 1 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
Number of packages to be installed: 1
The process will require 367 MiB more space.
96 MiB to be downloaded.
Proceed with this action? [y/N]: y
[pms] [1/1] Fetching plexmediaserver- 100% 96 MiB 685.4kB/s 02:27
Checking integrity… done (0 conflicting)
[pms] [1/1] Installing plexmediaserver-…
===> Creating groups.
Creating group ‘plex’ with gid ‘972’.
===> Creating users
Creating user ‘plex’ with uid ‘972’.
[pms] [1/1] Extracting plexmediaserver- 100%
Message from plexmediaserver-

multimedia/plexmediaserver includes an RC script:
sysrc plexmediaserver_enable=YES
service plexmediaserver start
Once started, visit the following to configure:
If you have a supported Intel GPU, you can leverage hardware
accelerated encoding/decoding in Plex Media Server on FreeBSD 12.0+.
The requirements are as follows:
* Install multimedia/drm-kmod: e.g., pkg install drm-fbsd12.0-kmod
* Enable loading of kernel module on boot: sysrc kld_list+=“i915kms”
** If Plex will run in a jail, you must load the module outside the jail!
* Load the kernel module now (although reboot is advised): kldload i915kms
* Add plex user to the video group: pw groupmod -n video -m plex
* For jails, make a devfs ruleset to expose /dev/dri/* devices.
e.g., /dev/devfs.rules on the host:
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add include $devfsrules_jail
add path ‘dri*’ unhide
add path ‘dri/’ unhide
add path 'drm
’ unhide
add path ‘drm/*’ unhide
* Enable the devfs ruleset for your jail. e.g., devfs_ruleset=10 in your
/etc/jail.conf or for iocage, iocage set devfs_ruleset=“10”
Please refer to documentation for all other FreeBSD jail management utilities.
* Make sure hardware transcoding is enabled in the server settings
root@pms:~ #

Well that looks better. Now I try and start plex:

root@pms:~ # service plexmediaserver start
Cannot ‘start’ plexmediaserver. Set plexmediaserver_enable to YES in /etc/rc.conf or use ‘onestart’ instead of ‘start’.
root@pms:~ # service plexmediaserver onestart
Starting plexmediaserver.
root@pms:~ # service plexmediaserver status
Cannot ‘status’ plexmediaserver. Set plexmediaserver_enable to YES in /etc/rc.conf or use ‘onestatus’ instead of ‘status’.
root@pms:~ # service plexmediaserver onestatus
plexmediaserver is not running.
root@pms:~ #

I am not yet out of the woods and into the Movies yet. I will spend some time tinkering later today.


That’s… odd. The script should have set plexmediaserver_enable=YES too. Obviously there are a number of things that should have happened, that didn’t. At this point, I’d say destroy the jail, and run the script again. Post the output here and let’s see if we can spot what went wrong.

Jail is deleted, repo cloned, config created. Do I need to clean this stuff up before I run the script again?