Plex Jail in FreeBSD
Tested using…
# uname -a
FreeBSD server 13.2-RELEASE-p2 FreeBSD 13.2-RELEASE-p2 GENERIC amd64
Create the jail
for plex.
bsdinstall jail /usr/jail/plex
No services should need to be enabled. Create a
root
user with password root
. When
prompted create a plex
user with password
plex
using defaults for all other settings.
Create an entry for the jail at /etc/jail.conf
with
the following contents.
plex {
host.hostname = "plex";
path = "/usr/jail/plex";
exec.clean;
# Use whatever IP you prefer
ip4.addr = 192.168.0.120;
exec.prestart += "mount -t nullfs -o ro,nofail /mnt/my/mount /usr/jail/plex/multimedia";
exec.poststop += "umount /usr/jail/plex/multimedia";
exec.start += "/bin/sh /etc/rc";
exec.stop = "/bin/sh /etc/rc.shutdown jail";
exec.consolelog = "/var/log/jail_plex_console.log";
mount.devfs;
devfs_ruleset = "11";
}
Start the jail
service jail start plex
Verify the jail is running
# jls
JID IP Address Hostname Path
1 192.168.0.120 plex /usr/jail/plex
Start a shell in that jail using the JID
returned by
jls
.
jexec 1
Configure jails to run at boot time on the host if not already
done by running the sysrc
command like so.
sysrc jail_enable=YES
Install Plex
in the jail.
(inside the jail) $ pkg install plexmediaserver
Enable plex
in the jail.
(inside the jail) $ sysrc plexmediaserver_enable=YES
Notes
Feel free to contact me with questions or feedback regarding this
article.