Installing SABnzbd on FreeNAS or TrueNAS 13

This is an updated guide to install SABnzbd and possibly other plugins like NZBGet in TrueNAS while maintaining the correct user permissions.

Prerequisite:
– A dataset created for the downloads (“Shared” in my example)
– “Shared” is own by the built-in user “media” and group “media” (PID/GID 8675309)
– Downloads goes to /mnt/Storage-Pool/Shared/z-complete
– Temporary files goes to /mnt/Storage-Pool/Shared/z-incomplete
– SSH is enabled on FreeNAS

Enter the following commands to build the SABnzbd from terminal:

  1. echo '{"pkgs":["sabnzbdplus","ca_root_nss"]}' > /tmp/pkg.json
  2. iocage create -n "sabnzbd" -p /tmp/pkg.json -r 13.1-RELEASE ip4_addr="vnet0|192.168.123.10/24" defaultrouter="192.168.123.1" vnet="on" allow_raw_sockets="1" boot="on"
    # Creates a jail called “sabnzbd” on 192.168.123.10 and the default gateway is 192.168.123.1
  3. rm /tmp/pkg.json
  4. iocage exec sabnzbd mkdir -p /mnt/downloads
    # Adds the folder “downloads” in the jail
  5. iocage exec sabnzbd mkdir -p /mnt/incompletes
    # Adds the folder “incompletes” in the jail
  6. iocage fstab -a sabnzbd /mnt/Storage-Pool/Shared/z-complete /mnt/downloads nullfs rw 0 0
    # Adds a mount point in pool /mnt/Storage-Pool/Shared/z-complete to /downloads in jail
  7. iocage fstab -a sabnzbd /mnt/Storage-Pool/Shared/z-incomplete /mnt/incompletes nullfs rw 0 0
    # Adds a mount point in pool /mnt/Storage-Pool/Shared/z-incomplete to /incomplete in jail
  8. iocage exec sabnzbd "pw groupadd -n media -g 8675309"
  9. iocage exec sabnzbd "pw user add media -c media -u 8675309 -d /nonexistent -s /usr/bin/nologin"
  10. iocage exec sabnzbd chown -R media:media /mnt/downloads /mnt/incompletes
  11. iocage exec sabnzbd sysrc "sabnzbd_user=media"
  12. iocage exec sabnzbd sysrc "sabnzbd_group=media"
    # Step 8 to 12 apply respective permissions and start sabnzbd service as “media”
  13. iocage exec sabnzbd sysrc sabnzbd_enable=YES
  14. iocage exec sabnzbd service sabnzbd start
  15. iocage exec sabnzbd service sabnzbd stop
  16. iocage exec sabnzbd chown -R media:media /var/run/sabnzbd
  17. iocage exec sabnzbd sed -i '' -e 's?host = 127.0.0.1?host = 0.0.0.0?g' /usr/local/sabnzbd/sabnzbd.ini
  18. iocage restart sabnzbd

This is how I built my SABnzbd and I recommend reapplying the permissions to the dataset to ensure the permissions within the jails mount-points and dataset to be consistent.

Once I open up SABnzbd interface, changed the config -> Folders to /mnt/downloads and /mnt/incompletes respectively and hit Save Changes.

Enjoy!