Plex Server Setup on FreeNAS (Jail)
Last Updated: March 1st, 2020
Adapted from here
Creating jail
echo '{"pkgs":["plexmediaserver-plexpass","ca_root_nss"]}' > /tmp/pkg.json
iocage create -n "plex" -p /tmp/pkg.json -r 11.3-RELEASE \
interfaces="vnet0:bridge0" \
ip4_addr="vnet0|10.2.0.202/24" \
defaultrouter="10.2.0.1" \
vnet="on" \
allow_raw_sockets="1" \
boot="on"
Mount folders
iocage exec plex mkdir -p /config
iocage exec plex mkdir -p /mnt/movies
iocage exec plex mkdir -p /mnt/tv
iocage exec plex mkdir -p /mnt/courses
iocage exec plex mkdir -p /mnt/photos
iocage exec plex mkdir -p /mnt/home-videos
iocage exec plex mkdir -p /mnt/music
iocage fstab -a plex /mnt/NVMeStore/apps/plex /config nullfs rw 0 0
iocage fstab -a plex /mnt/FileStore/Media/Movies /mnt/movies nullfs ro 0 0
iocage fstab -a plex /mnt/FileStore/Media/TV /mnt/tv nullfs ro 0 0
iocage fstab -a plex /mnt/FileStore/Media/Courses /mnt/courses nullfs ro 0 0
iocage fstab -a plex /mnt/FileStore/Media/Photos /mnt/photos nullfs ro 0 0
iocage fstab -a plex /mnt/FileStore/Media/Videos /mnt/home-videos nullfs ro 0 0
iocage fstab -a plex /mnt/FileStore/Media/Music /mnt/music nullfs ro 0 0
iocage exec plex chown -R plex:plex /config
Allow the plex user access to the directories (add plex user to group)
pw groupadd -n media -g 8675309 # Replace this with your group ID
pw groupmod media -m plex
Plex service setup
iocage exec plex sysrc "plexmediaserver_plexpass_enable=YES"
iocage exec plex sysrc plexmediaserver_plexpass_support_path="/config"
iocage exec plex service plexmediaserver_plexpass start
Enable SSH
iocage exec plex sysrc sshd_enable="YES"
iocage exec plex service sshd start
Enable ssh password authentication, edit the following file:
ee /etc/ssh/sshd_config
PermitRootLogin="Yes"
UsePAM="Yes"
Perform first-time setup
SSH tunnel
ssh 10.2.0.202 -L 32400:localhost:32400
go to https://localhost:32400/web
Upgrading
ee /etc/pkg/FreeBSD.conf
Change to latest:
FreeBSD: {
url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
mirror_type: "srv",
signature_type: "fingerprints",
fingerprints: "/usr/share/keys/pkg",
enabled: yes
}
pkg upgrade plexmediaserver-plexpass