Scripted installation of Plex Media Server in a FreeNAS jail
This is a simple script to automate installation of Plex Media Server in a FreeNAS jail, following current best practices. It will create a jail, install Plex Media Server (with or without PlexPass), configure Plex to store its preferences and metadata outside the jail, and create a cron job to update the installed packages every week using the FreeBSD latest
repository rather than quarterly
.
This script does not address media storage for the jail. That will ordinarily be one or more external datasets on your FreeNAS server, which you can mount to a desired location inside the jail. Because this depends very much on your data layout and personal preferences, this is left up to the user.
On your FreeNAS server, change to a convenient directory, and download this script using git clone https://github.com/danb35/freenas-iocage-plex
. Then create a configuration file called plex-config
using your preferred text editor. In its simplest form, the file would look like this:
JAIL_IP="192.168.1.75"
DEFAULT_GW_IP="192.168.1.1"
POOL_PATH="/mnt/tank"
These values must be set. They correspond to:
Optional configuration values include:
/media
inside the jail. Specify a full path, for example "/mnt/tank/Media".$POOL_PATH/plex_data
.24
, which is 255.255.255.0
.$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.
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.
Once you've prepared the configuration file, run the script by running ./plex-jail.sh
. It should run for a few minutes and report completion. You can then add storage to your jail as desired (see Uncle Fester's Guide for one example), and log in to configure your media server.
Note that if you are interested in hardware transcode, instructions for setting this up in FreeNAS 11.3 can be found at https://github.com/kern2011/Freenas-Quicksync .