Scripted installation of Plex Media Server

The “Plex Pass” version of the server software is beta software. If you want to install that, use the USE_BETA flag, as described in the README.

Not with the script. You’d need to add the additional mountpoints to the jail after the script finishes.

1 Like

Hey I’m trying to set the PLEX_CONFIG_PATH to take advantage of a dataset. But when I run the script it ends up pointing to the iocage location:

/mnt/Media/iocage/jails/PlexPass/root/config

Here is my plex-config file:

JAIL_IP="192.168.1.40"
DEFAULT_GW_IP="192.168.1.1"
POOL_PATH="/mnt/Media"
PLEX_CONFIG_PATH="/mnt/Media/Storage/Plex/plex_data"
JAIL_NAME="PlexPass"
USE_BETA="1"

What am I doing wrong here?

I’m not quite sure I understand what’s going on. From your FreeNAS box, what’s the output of iocage fstab -l PlexPass?

Here ya go:

+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| INDEX |                                                                    FSTAB ENTRY                                                                    |
+=======+===================================================================================================================================================+
| 0     | /mnt/Media/iocage/releases/11.3-RELEASE/root/bin        /mnt/Media/iocage/jails/PlexPass/root/bin       nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 1     | /mnt/Media/iocage/releases/11.3-RELEASE/root/boot       /mnt/Media/iocage/jails/PlexPass/root/boot      nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 2     | /mnt/Media/iocage/releases/11.3-RELEASE/root/lib        /mnt/Media/iocage/jails/PlexPass/root/lib       nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 3     | /mnt/Media/iocage/releases/11.3-RELEASE/root/libexec    /mnt/Media/iocage/jails/PlexPass/root/libexec   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 4     | /mnt/Media/iocage/releases/11.3-RELEASE/root/rescue     /mnt/Media/iocage/jails/PlexPass/root/rescue    nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 5     | /mnt/Media/iocage/releases/11.3-RELEASE/root/sbin       /mnt/Media/iocage/jails/PlexPass/root/sbin      nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 6     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/bin    /mnt/Media/iocage/jails/PlexPass/root/usr/bin   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 7     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/include        /mnt/Media/iocage/jails/PlexPass/root/usr/include       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 8     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/lib    /mnt/Media/iocage/jails/PlexPass/root/usr/lib   nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 9     | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/libexec        /mnt/Media/iocage/jails/PlexPass/root/usr/libexec       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 10    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/sbin   /mnt/Media/iocage/jails/PlexPass/root/usr/sbin  nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 11    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/share  /mnt/Media/iocage/jails/PlexPass/root/usr/share nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 12    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/libdata        /mnt/Media/iocage/jails/PlexPass/root/usr/libdata       nullfs  ro      0       0 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 13    | /mnt/Media/iocage/releases/11.3-RELEASE/root/usr/lib32  /mnt/Media/iocage/jails/PlexPass/root/usr/lib32 nullfs  ro      0       0                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+
| 14    | /mnt/Media/Storage/Plex /mnt/Media/iocage/jails/PlexPass/root/config    nullfs  rw      0       0                                                 |
+-------+---------------------------------------------------------------------------------------------------------------------------------------------------+

This all looks as it should. What exactly is the problem?

Isn’t the plex_data directory supposed to go into the specified directory in the config file? Right now it’s putting it into the iocage/jail directory like a default Plex install.

So I just decided to try setting the POOL_PATH instead rather than trying to use the CONFIG_PATH.

POOL_PATH="/mnt/Media/Storage/Plex"

Seems like that worked. Hopefully it will help resolve me separate issue of not being able to migrate my old data over to the new jail.

UPDATE:

And it worked!!! Everything migrated just fine. :smiley:

Hey quick question. How is updating handled with the jail created by your script? Does the jail update button in the FreeNAS work or does it have to be handled via command prompt?

The packages in the jail are updated automatically by a cron job that’s installed by the script. If you want to update the FreeBSD release in the jail (e.g., from 11.3 to 11.4), you should be able to do that in the FreeNAS GUI.

Hi Dan,

First of all, well done and congrats for creating what appears to be a very popular solution, you should certainly give yourself a pat on the back when your hands aren’t on the keyboard!

I was genuinely hoping to be with of those that had no issue, and merely leave you a message consisting of gratitude…unfortunately I’m having a little issue, that’s no doubt user error. There is no hurry at all, I’ve been learning FreeNAS during the past 6 months or so, I’ve been using Plex via the plugin without issue - but as you know, it’s not a very migratable plugin, so I saw your script and thought, “perfect!”.

If you had time to indulge me, here are a few details:

FreeNAS Version: FreeNAS-11.3-U3.2
Existing Plex Jail: Yes
Plex Pass: Yes
Method of getting script: git clone and your url
Permissions set: everyone (already 972 plex user account created for working install, via plugin method)

plex-config contents:

JAIL_IP=“192.168.1.50”
DEFAULT_GW_IP=“192.168.1.1”
POOL_PATH="/mnt/nvme/nvme/Plex-data"

Install process notes: none, all successful.
Installed via Shell or SSH: SSH (putty)
Jail status: JID provided / State is UP
Other evidence: Router shows IP allocated (ending 50 as above)
URL used to connect to install: http://192.168.1.50:32400/web
Success: No. Browser message: “This site can’t be reached. 192.168.1.50 refused to connect.”

If I can provide any other information do say so, but like I said, this is such low priority as I’m very inferior in knowledge compared to people such as yourself…nevertheless, thanks in advance!

Chris

Hi,

Just installed TrueNAS CORE, latest version; seems they have altered the release strings…
GUI says the version is TrueNAS-12.0-RELEASE but when the script runs freebsd-version 12.2-RC3 is returned, and breaks the script when it tries to create the jail. I manually altered the script to return “12.2-RELEASE” for the ${RELEASE} variable, but thought you might like the heads up to perhaps amend…
Script works fine apart from this on TrueNAS - many thanks for your work on it :slight_smile:

You’re right, went through this with the Nextcloud script. Should be fixed now.

Sorry about taking so long to get back to you–your post slipped off my radar. The refused connection suggests to me that Plex isn’t actually running in your jail. To check that, enter the jail with iocage console pms, and then run service plexmediaserver status. What’s the output?

1 Like

Hi Dan, thank you very much for getting back to me, really kind of you.

I’m being evicted from my office soon (new owners), but as soon as I’ve built a new one, I’ll get right back to this as I would really like to do it properly. Thanks again, Chris

Hi danb35,

I love this idea of installing Plex on FreeNAS.

Is your script compatible with TrueNAS Core (12.0)? If not, is there a line or two to tweak so it will run on TrueNAS?

Thank you in advance.

The script should run as-is on TrueNAS CORE 12.0.

1 Like

Hey Dan, quick question. Is there a way to force the update cron job to run? I ran into a bad Plex version where I can’t access the server settings. So I either need to revert or push past to the latest version.

Easiest thing to do would be to get to a shell in the jail (iocage console pms), and then run pkg upgrade. Once it finishes, service plexmediaserver restart.

Hi Dan, had the same issue as bikerchris, went ahead and did as you told him running service plexmediaserver status, and got the below:

plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/usr/local/etc/rc.d), or is not executable

Thanks!

Went ahead and tried reinstalling, kept getting stuck and timing out at “>Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait…”

After a couple times it worked eventually but still getting the same errors. Below is the install.

Blockquoteroot@truenas[~/freenas-iocage-plex]# ./plex-jail.sh
Netmask not set, defaulting to /24 (255.255.255.0)
Plex metadata path not set, defaulting to /mnt/tank/plex_data
Plex media path not set, please mount media directory manually when done
Not configuring hardware transcode
Using stable-release plexmediaserver code
Creating jail pms. This may take a minute, please be patient.
pms successfully created!
No default gateway found for ipv6.

  • Starting pms
    • Started OK
    • Using devfs_ruleset: 1000 (iocage generated default)
    • Configuring VNET OK
    • Using IP options: vnet
    • Starting services OK
    • Executing poststart OK
      Successfully added mount to pms’s fstab
      Successfully added mount to pms’s fstab
      Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:12:amd64/latest, please wait…
      plexmediaserver_enable: → YES
      plexmediaserver_support_path: → /config
      Successfully removed mount from pms’s fstab
  • Stopping pms
    • Executing prestop OK
    • Stopping services OK
    • Tearing down VNET OK
    • Removing devfs_ruleset: 1000 OK
    • Removing jail process OK
    • Executing poststop OK
      Installation Complete!
      Mount your media folder into the jail, then start the jail.
      Log in and configure your server by browsing to:
      http://192.168.2.4:32400/web

root@truenas[~/freenas-iocage-plex]# service plexmediaserver status
plexmediaserver does not exist in /etc/rc.d or the local startup
directories (/etc/ix.rc.d /usr/local/etc/rc.d), or is not executable

root@truenas[~/freenas-iocage-plex]# pkg install plexmediaserver
Updating local repository catalogue…
pkg: file:///usr/ports/packages/meta.txz: No such file or directory
repository local has no meta file, using default settings
pkg: file:///usr/ports/packages/packagesite.txz: No such file or directory
Unable to update repository local
Error updating repositories!