Scripted installation of Plex Media Server

My script doesn’t do anything to the contents of PLEX_CONFIG_PATH–any data in there should be preserved.

1 Like

I wish I hadn’t been so stubborn about sticking close to plugins in the FreeNAS GUI. This script addresses all the issues you’ve identified with the Plex plugin. Love it!

Just one observation. This is an extract from the installation notes…

$PLEX_CONFIG_PATH need not exist before running this script; if it doesn’t, the script will create it. The script will also set ownership of that directory to the user/group IDs for Plex Media Server. If this directory already exists, it must not be using Windows permissions.

When I first ran the script, I went looking for the directory in the FreeNAS GUI. It wasn’t visible. I found it through the Shell instead. I decided to destroy the created jail and remove the directory. I then created $PLEX_CONF_PATH beforehand as a dataset rather than as a directory. The advantage for me is that I can easily see the size of Plex configuration data from the GUI under Storage > Pools. I found this step useful.

EDIT: I just spotted some discussion about this further up in the thread. While I understand your concern about not creating the dataset within the script, I wonder whether the installation notes could be revised to make this point more visible?

I made it through the install without issue and everything is running. However, I can’t seem to figure out the proper permissions to the share… rather the right user/group to assign rights to. I set @everyone to read access and that worked to view movies I had uploaded. I then tried auto uploading from my phone and that only worked if I gave everyone write access. So, I know it’s a permission issue. I tried to figure out the Plex User name/id but don’t know enough about FreeBSD to know where to look. Any help would be appreciated.

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?