#FreeNAS 11 Jails setup for Plex, PlexPy, Sonarr, Radarr, Jackett, NZBGet, and Ombi #Note: if you want folding to make things easier to follow, use Notepad++ and add user defined language with open "//{" and close tags "//}" //{ #DATASETS #Create (1) Unix dataset to store your media content (possibly 2 if you want to seperate torrents) #Create (1) parent Unix dataset named apps and a child dataset of apps for each app installed (7 in my case). Configs will #be stored here. #DATASETS [MD=main dataset] [JD=jail dataset] | |_ /mnt/[MD] | | | |_ /mnt/[MD]/video | | | |_ /mnt/[JD] | |_ /mnt/[JD]/apps | |_ /mnt/[JD]/apps/plex |_ /mnt/[JD]/apps/plexpy |_ /mnt/[JD]/apps/sonarr |_ /mnt/[JD]/apps/radarr |_ /mnt/[JD]/apps/jackett |_ /mnt/[JD]/apps/nzbget |_ /mnt/[JD]/apps/ombi //} //{ #Plex (IP=192.168.0.208) (Default Port=32400) plex:plex 972 #Mounts HOST JAIL /mnt/[MD]/video /mnt/video (read only) /mnt/[MD]/apps/plex /usr/local/plexdata #Install pkg update && pkg upgrade pkg install nano plexmediaserver #Enable service and start it sysrc "plexmediaserver_enable=YES" service plexmediaserver start #Available at http://IP:Port/web //} //{ #PlexPy (IP=192.168.0.209) (Default Port=8181) plexpy:plexpy 500 #Mounts HOST JAIL /mnt/[MD]/apps/plex/Plex Media Server/logs /plexlogs (read only) /mnt/[MD]/apps/plexpy /config #Install Dependancies pkg update && pkg upgrade pkg install nano python2 databases/py-sqlite3 security/py-openssl security/ca_root_nss git #Install Plexpy cd /usr/local/share/ git clone https://github.com/JonnyWong16/plexpy.git #Create a user for Plexpy to run as, run the adduser command and use the following options in order where [] signifies #default answer (just press enter) adduser plexpy plexpy 500 [] [] [] nologin [] [] no no #Make the Plexpy applications directorys owned by the plexpy user chown -R plexpy:plexpy /usr/local/share/plexpy chown -R plexpy:plexpy /config #Copy the rc script and enable the plexpy service using /config directory for its application data. cp /usr/local/share/plexpy/init-scripts/init.freenas /usr/local/etc/rc.d/plexpy chmod u+x /usr/local/etc/rc.d/plexpy sysrc "plexpy_enable=YES" sysrc "plexpy_flags=--datadir /config" service plexpy start #Available at http://IP:Port //} //{ #Radarr (IP=192.168.0.210) (Default Port=7878) radarr:radarr 501 #Mounts HOST JAIL /mnt/[MD]/video /mnt/video /mnt/[JD]/apps/radarr /config #Install Dependancies pkg update && pkg upgrade pkg install nano mono mediainfo sqlite3 #Link Mono to /usr/bin/mono so Radarr can update properly on its own with its built in update functionality ln -s /usr/local/bin/mono /usr/bin/mono #Install Radarr and update once running cd /usr/local/share fetch https://github.com/Radarr/Radarr/releases/download/v0.2.0.852/Radarr.develop.0.2.0.852.linux.tar.gz tar -xzvf Radarr.*.linux.tar.gz rm Radarr.*.linux.tar.gz #Create a user for Radarr to run as, run the adduser command and use the following options in order where [] signifies #default answer (just press enter) adduser radarr radarr 501 [] [] [] nologin [] [] no no #Make Radarr the owner the Radarr files chown -R radarr:radarr /usr/local/share/Radarr chown -R radarr:radarr /config //{ #Create an rc file for radarr using your favorite editor at /usr/local/etc/rc.d/radarr #!/bin/sh # $FreeBSD$ # # PROVIDE: radarr # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # radarr_enable: Set to YES to enable radarr # Default: NO # radarr_user: The user account used to run the radarr daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run as root. # Default: media # radarr_group: The group account used to run the radarr daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run with group wheel. # Default: media # radarr_data_dir: Directory where radarr configuration # data is stored. # Default: /var/db/radarr . /etc/rc.subr name=radarr rcvar=${name}_enable load_rc_config $name : ${radarr_enable:="NO"} : ${radarr_user:="radarr"} : ${radarr_group:="radarr"} : ${radarr_data_dir:="/config"} pidfile="${radarr_data_dir}/nzbdrone.pid" command="/usr/sbin/daemon" procname="/usr/local/bin/mono" command_args="-f ${procname} /usr/local/share/Radarr/Radarr.exe --data=${radarr_data_dir} --nobrowser" start_precmd=radarr_precmd radarr_precmd() { if [ ! -d ${radarr_data_dir} ]; then install -d -o ${radarr_user} -g ${radarr_group} ${radarr_data_dir} fi export XDG_CONFIG_HOME=${radarr_data_dir} } run_rc_command "$1" //} #Make the rcfile executable and enable the service chmod u+x /usr/local/etc/rc.d/radarr sysrc "radarr_enable=YES" service radarr start #Available at http://IP:Port //} //{ #Sonarr (IP=192.168.0.211) (Default Port=8989) sonarr:sonarr 502 #Mounts Host Jail /mnt/[MD]/video /mnt/video /mnt/[JD]/apps/sonarr /config #Install Dependancies pkg update && pkg upgrade pkg install nano mono mediainfo sqlite3 #Link Mono to /usr/bin/mono so Sonarr can update properly on its own with its built in update functionality ln -s /usr/local/bin/mono /usr/bin/mono #Install Sonarr (you may want to grab the lastest release URL however you can just update Sonarr from its web UI once you #have it running :) ) cd /usr/local/share fetch http://download.sonarr.tv/v2/master/mono/NzbDrone.master.tar.gz tar -xzvf NzbDrone.master.tar.gz rm NzbDrone.master.tar.gz #Create a user for Sonarr to run as, run the adduser command and use the following options in order where [] signifies #default answer (just press enter) adduser sonarr sonarr 502 [] [] [] nologin [] [] no no #Make Sonarr the owner the Sonarr files chown -R sonarr:sonarr /usr/local/share/NzbDrone chown -R sonarr:sonarr /config //{ #Create an rc file for sonarr using your favorite editor at /usr/local/etc/rc.d/sonarr #!/bin/sh # $FreeBSD$ # # PROVIDE: sonarr # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # sonarr_enable: Set to YES to enable sonarr # Default: NO # sonarr_user: The user account used to run the sonarr daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run as root. # Default: media # sonarr_group: The group account used to run the sonarr daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run with group wheel. # Default: media # sonarr_data_dir: Directory where sonarr configuration # data is stored. # Default: /var/db/sonarr . /etc/rc.subr name=sonarr rcvar=${name}_enable load_rc_config $name : ${sonarr_enable:="NO"} : ${sonarr_user:="sonarr"} : ${sonarr_group:="sonarr"} : ${sonarr_data_dir:="/config"} pidfile="${sonarr_data_dir}/nzbdrone.pid" command="/usr/sbin/daemon" procname="/usr/local/bin/mono" command_args="-f ${procname} /usr/local/share/NzbDrone/NzbDrone.exe --data=${sonarr_data_dir} --nobrowser" start_precmd=sonarr_precmd sonarr_precmd() { if [ ! -d ${sonarr_data_dir} ]; then install -d -o ${sonarr_user} -g ${sonarr_group} ${sonarr_data_dir} fi export XDG_CONFIG_HOME=${sonarr_data_dir} } run_rc_command "$1" //} #Make the rcfile executable and enable the service chmod u+x /usr/local/etc/rc.d/sonarr sysrc "sonarr_enable=YES" service sonarr start #Available at http://IP:Port //} //{ #Jackett (IP=192.168.0.212) (Default Port=9117) jackett:jackett 503 #Mounts Host Jail /mnt/tank1/apps/jackett /config #Install Dependancies pkg update && pkg upgrade pkg install nano mono mediainfo sqlite3 #Link Mono to /usr/bin/mono so Jackett can update properly on its own ln -s /usr/local/bin/mono /usr/bin/mono #Install Jackett, Jackett like sonarr and radarr has its own updater that you can run from the webui if you don't want to #grab the latest install url cd /usr/local/share fetch https://github.com/Jackett/Jackett/releases/download/v0.8.225/Jackett.Binaries.Mono.tar.gz tar -xzvf Jackett.Binaries.Mono.tar.gz rm Jackett.Binaries.Mono.tar.gz #Create a user for Jackett to run as, run the adduser command and use the following options in order where [] signifies #default answer (just press enter) adduser jackett jackett 818 [] [] [] nologin [] [] no no #Make Jackett the owner the Jackett files chown -R jackett:jackett /usr/local/share/Jackett chown -R jackett:jackett /config //{ #Create an rc file for jackett using your favorite editor at /usr/local/etc/rc.d/jackett #!/bin/sh # $FreeBSD$ # # PROVIDE: jackett # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # jackett_enable: Set to YES to enable jackett # Default: NO # jackett_user: The user account used to run the jackett daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run as root. # Default: media # jackett_group: The group account used to run the jackett daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run with group wheel. # Default: media # jackett_data_dir: Directory where jackett configuration # data is stored. # Default: /var/db/jackett . /etc/rc.subr name=jackett rcvar=${name}_enable load_rc_config $name : ${jackett_enable:="NO"} : ${jackett_user:="jackett"} : ${jackett_group:="jackett"} : ${jackett_data_dir:="/config"} pidfile="${jackett_data_dir}/jackett.pid" command="/usr/sbin/daemon" procname="/usr/local/bin/mono" command_args="-f ${procname} /usr/local/share/Jackett/JackettConsole.exe -d ${jackett_data_dir}" start_precmd=jackett_precmd jackett_precmd() { if [ ! -d ${jackett_data_dir} ]; then install -d -o ${jackett_user} -g ${jackett_group} ${jackett_data_dir} fi export XDG_CONFIG_HOME=${jackett_data_dir} } run_rc_command "$1" //} #Make the rcfile executable and enable the service chmod u+x /usr/local/etc/rc.d/jackett sysrc "jackett_enable=YES" service jackett start #Available at http://IP:Port //} //{ #NZBGet (IP=192.168.0.213) (Default Port=6789) nzbget:nzbget 504 #Mounts Host Jail /mnt/[MD]/video /mnt/video /mnt/[JD]/apps/nzbget /config #Install QoL editor pkg update && pkg upgrade pkg install nano #First run of portsnap portsnap fetch extract update #Install NZBGet (this can take a while) select the config options you want, defaults are recommended cd /usr/ports/news/nzbget/ && make config make install clean #Make a scripts folder mkdir -p /config/scripts #Copy config and move scripts cp /usr/local/share/nzbget/nzbget.conf /config/nzbget.conf mv /usr/local/share/nzbget/scripts /config/ //{ #Update nzbget.conf file (you can configure everything here or just what's below MainDir=/mnt/video WebDir=/usr/local/share/nzbget/webui ScriptDir=/config/scripts LockFile=/config/nzbget.lock ConfigTemplate=/usr/local/share/nzbget/nzbget.conf CertStore=/etc/ssl/cert.pem #May differ for some people, see where ca_root_nss puts certs for you ControlUsername=[admin user] ControlPassword=[admin password] CertCheck=yes DaemonUsername=nzbget UMask=0002 //} #Create a user for NZBGet to run as, run the adduser command and use the following options in order where [] signifies #default answer (just press enter) adduser nzbget nzbget 504 [] [] [] nologin [] [] no no #Make NZBGet the owner the NZBGet files chown -R nzbget:nzbget /usr/local/share/nzbget chown -R nzbget:nzbget /config //{ #Create an rc file for nzbget using your favorite editor at /usr/local/etc/rc.d/nzbget #!/bin/sh # $FreeBSD$ # # PROVIDE: nzbget # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # nzbget_enable: Set to YES to enable nzbget # Default: NO # nzbget_user: The user account used to run the nzbget daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run as root. # Default: media # nzbget_group: The group account used to run the nzbget daemon. # This is optional, however do not specifically set this to an # empty string as this will cause the daemon to run with group wheel. # Default: media # nzbget_data_dir: Directory where nzbget configuration # data is stored. # Default: /var/db/nzbget . /etc/rc.subr name=nzbget rcvar=${name}_enable load_rc_config $name : ${nzbget_enable:="NO"} : ${nzbget_user:="nzbget"} : ${nzbget_group:="nzbget"} : ${nzbget_data_dir:="/config"} pidfile="${nzbget_data_dir}/${name}.lock" command="/usr/local/bin/${name}" command_args="-c ${nzbget_data_dir}/nzbget.conf -D" start_precmd=${name}_precmd nzbget_precmd() { if [ ! -d ${nzbget_data_dir} ]; then install -d -o ${nzbget_user} -g ${nzbget_group} ${nzbget_data_dir} fi export XDG_CONFIG_HOME=${nzbget_data_dir} } run_rc_command "$1" //} #Make the rcfile executable and enable the service chmod u+x /usr/local/etc/rc.d/nzbget sysrc "nzbget_enable=YES" service nzbget start #If you haven't setup group write permissions on your video dataset yet you'll get some errors here but they are just #saying folders can't be created. You can still check that the webui works and update permissions after. #Available at http://IP:Port default user:nzbget, password:tegbzn6789 //} //{ #Ombi (IP=192.168.0.214) (Default Port=3579) ombi:ombi 505 #Mounts Host Jail /mnt/[JD]/apps/ombi /config #Install Dependancies pkg update && pkg upgrade pkg install nano mono ca_root_nss unzip sqlite3 #Link Mono to /usr/bin/mono ln -s /usr/local/bin/mono /usr/bin/mono #Fetch Ombi and copy files to final location fetch -o /tmp https://ci.appveyor.com/api/buildjobs/bpbd7olow6ipl745/artifacts/Ombi.zip mkdir -p /usr/local/bin/ombi unzip -d /tmp /tmp/Ombi.zip mv /tmp/Release/* /usr/local/bin/ombi/ rm -r /tmp/Release/ /tmp/Ombi.zip #Create an empty sqlite db in the /config folder and a Backups folder sqlite3 /config/Ombi.sqlite "create table aTable(field1 int); drop table aTable;" mkdir -p /config/Backups #Link the config files to Ombi folder ln -s /config/Ombi.sqlite /usr/local/bin/ombi/Ombi.sqlite ln -s /config/Backups /usr/local/bin/ombi/Backups #Create a user for Ombi to run as pw useradd ombi -d /nonexistent -s /usr/bin/nologin -c "ombi service account" -u 505 #Make ombi the owner of the application files chown -R ombi:ombi /usr/local/bin/ombi chown -R ombi:ombi /config //{ #Create an rc file for ombi using your favorite editor at /usr/local/etc/rc.d/ombi #!/bin/sh # # $FreeBSD$ # # PROVIDE: ombi # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # ombi_enable (bool): Set to NO by default. # Set it to YES to enable it. # ombi_user: The user account ombi daemon runs as what # you want it to be. It uses 'ombi' user by # default. Do not sets it as empty or it will run # as root. # ombi_group: The group account ombi daemon runs as what # you want it to be. It uses 'ombi' group by # default. Do not sets it as empty or it will run # as wheel. # ombi_data_dir: Directory where ombi configuration # data is stored. # Default: /usr/local/bin/ombi . /etc/rc.subr name=ombi rcvar=ombi_enable load_rc_config ${name} : ${ombi_enable:=NO} : ${ombi_user:=ombi} : ${ombi_group:=ombi} : ${ombi_data_dir:="/config"} procname="/usr/local/bin/mono" command="/usr/sbin/daemon" command_args="-f ${procname} /usr/local/bin/ombi/Ombi.exe" start_precmd=ombi_precmd ombi_precmd() { if [ ! -d ${ombi_data_dir} ]; then install -d -o ${ombi_user} -g ${ombi_group} ${ombi_data_dir} fi export XDG_CONFIG_HOME=${ombi_data_dir} } run_rc_command "$1" //} #Make the rcfile executable and enable the service chmod u+x /usr/local/etc/rc.d/ombi sysrc "ombi_enable=YES" service ombi start #Available at http://IP:Port //}