Creating a media management jail in FreeBSD
This post explains how to make a media management jail in FreeBSD/FreeNAS that includes:
- Plex media server
- Sonarr
- Radarr
- SABnzbd
- Transmission
- nginx as a reverse proxy for the above
Creating the jail
If you are running FreeNAS, simply create a new jail from the jail template. If you are on FreeBSD, follow the instructions below.
- Enable jails on the host machine
|
|
- Create a dataset for the jail. Replace the paths with paths that are appropriate for your system.
|
|
- Install FreeBSD in to the jail
|
|
- Copy DNS settings and time to the new jail
|
|
- Create
/etc/jail.conf
and enter the appropriate configuration
|
|
- Create the
fstab
file
|
|
- Enter the paths you wish to present to the jail in to the fstab
|
|
- Create the folder that will be mounted
|
|
- Create and start the new jail
|
|
Creating the mediagroup group on the host system, and assigning permissions
- Create a group on the host system with the name being
mediagroup
and the group ID being816
. For FreeNAS this can be done through the GUI, for FreeBSD run:
|
|
- Next, change the owner and permissions of the folders so that the jail can read and write through the shared mediagroup
|
|
Installing the apps
Enter the new jail. In FreeNAS you can click the terminal window. In FreeBSD, run
jexec mediajail /bin/sh
If the jail is in an unsupported version of FreeBSD (looking at you FreeNAS), an unsupported version of
sqlite3
is needed. Run the following, accepting all defaults
|
|
- Run
pkg install
with the application names. If you do not have Plex Pass, replaceplexmediaserver-plexpass
withplexmediaserver
|
|
- Enable all the applications to start on bootup of the jail. Again, if you do not have Plex Pass, replace
plexmediaserver_plexpass_enable=YES
withplexmediaserver_enable=YES
|
|
- Create the
mediagroup
group in the jail and add all the appliation accounts needed
|
|
- Start the applications
|
|
Configuring SABnzbd
- SABnzbd only allows connections from
localhost
initially. First, stopsabnzbd
|
|
- Replace the host line in the config
|
|
- Start
sabnzbd
|
|
- Log in to SABnzbd in your browser at:
|
|
Run through the initial setup of SABnzbd, inputting the language and news server details.
Once in SABnzbd, click on the cog in the top right corner to get to the settings.Click on the cog on the top to get to “General” settings.
Set up a username and password, then click “Save Changes”.
Go to the “Folders” settings and click “Advanced Settings”. Set the “Temporary Download Folder” to:
|
|
- Set the “Completed Download Folder” to:
|
|
- Set the “Permissions for completed downloads” to
775
then press “Save Changes”.
Configuring Transmission
- Transmission only allows connections from
localhost
initially, same as SABnzbd. First, stoptransmission
|
|
- Open
settings.json
and edit the following lines:
|
|
- Sometimes the download directory set does not stick. Change this with a variable
|
|
- Start transmission
|
|
- Log in to Transmission in your browser at:
|
|
Configuring Sonarr
- Log in to Sonarr in your browser at:
|
|
Go to “Settings” and then “General”
Change the “URL Base” to:
|
|
- Set the “Authentication” to
Forms
and enter a Username and Password. Click “Save”.
Configuring Radarr
- Log in to Radarr in your browser at:
|
|
Go to “Settings” and then “General”
Change the “URL Base” to:
|
|
- Set the “Authentication” to
Forms
and enter a Username and Password. Click “Save”.
Configuring nginx
- Stop the nginx service
|
|
- Open
/usr/local/etc/nginx/nginx.conf
in an editor and change to the following, changing when needed
|
|
- Start nginx
|
|
- Tell Certbot to generate a new SSL certificate
|
|
- Reload nginx for the certificate to take effect
|
|
- Set up a new cron schedule with
visudo
|
|
Finishing up
You can now access services through the following:
- Sonarr - https://
<hostname>
/sonarr - Radarr - https://
<hostname>
/radarr - SABnzbd - https://
<hostname>
/sabnzbd - Transmission - https://
<hostname>
/transmission