Yakje
Explorer
- Joined
- Feb 8, 2017
- Messages
- 82
While i was looking for an installation guide on how to install NzbHydra2 in a iocage jail in FN11.2, i was unable to find any.
Since i do really like the added benefit of running nzbhydra2, i tried to figure it out for myself and eventually succeeded!
I figured this could also be helpfull for others, which is why i decided to share it here.
Create jail + install dependencies
Create config folder + mount points
Download and install NzbHydra2 (you can change the link to a newer release if you desire)
Download nzbhydrawrapper
Set permissions
Create rc directory
Upload NzbHydra2 RC file to: /usr/local/etc/rc.d
Make rc file readable and start nzbhydra2
NzbHydra2 should now be able at:
http://<JailIP>:5076
Since i do really like the added benefit of running nzbhydra2, i tried to figure it out for myself and eventually succeeded!
I figured this could also be helpfull for others, which is why i decided to share it here.
Create jail + install dependencies
echo '{"pkgs":["openjdk8","python27","ca_root_nss"]}' > /tmp/pkg.json
iocage create -n "nzbhydra" -p /tmp/pkg.json -r 11.2-RELEASE ip4_addr="vnet0|<JAIL IP>/24" defaultrouter="<DEFAULT GATEWAY IP>" vnet="on" allow_raw_sockets="1" boot="on"
rm /tmp/pkg.json
Create config folder + mount points
iocage exec nzbhydra mkdir -p /config
iocage fstab -a nzbhydra /mnt/tank/apps/nzbhydra /config nullfs rw 0 0
Download and install NzbHydra2 (you can change the link to a newer release if you desire)
iocage exec nzbhydra ln -s /usr/local/bin/python2.7 /usr/local/bin/python
iocage exec nzbhydra "fetch https://github.com/theotherp/nzbhydra2/releases/download/v2.3.19/nzbhydra2-2.3.19-linux.zip -o /usr/local/share"
iocage exec nzbhydra "unzip /usr/local/share/nzbhydra2-2.3.19-linux.zip -d /usr/local/share/Nzbhydra"
iocage exec nzbhydra rm /usr/local/share/nzbhydra2-2.3.19-linux.zip
Download nzbhydrawrapper
iocage exec nzbhydra "fetch https://raw.githubusercontent.com/theotherp/nzbhydra2/master/other/wrapper/nzbhydra2wrapper.py -o /usr/local/share/Nzbhydra"
Set permissions
iocage exec nzbhydra "pw user add nzbhydra2 -c nzbhydra2 -u 1001 -d /nonexistent -s /usr/bin/nologin"
iocage exec nzbhydra chown -R nzbhydra2:nzbhydra2 /config /usr/local/share/Nzbhydra
Create rc directory
iocage exec nzbhydra mkdir /usr/local/etc/rc.d
Upload NzbHydra2 RC file to: /usr/local/etc/rc.d
Code:
#!/bin/sh # # PROVIDE: nzbhydra2 # REQUIRE: LOGIN # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf.local or /etc/rc.conf # to enable this service: # # nzbhydra2_enable (bool): Set to NO by default. # Set it to YES to enable it. # nzbhydra2_user: The user account nzbhydra daemon runs as what # you want it to be. It uses '_sabnzbd' user by # default. Do not sets it as empty or it will run # as root. # nzbhydra2_group: The group account nzbhydra daemon runs as what # you want it to be. It uses 'nzbhydra2' group by # default. Do not sets it as empty or it will run # as wheel. # nzbhydra2_dir: Directory where nzbhydra lives. # Default: /usr/local/nzbhydra2 # nzbhydra2_datafolder: Data directory for nzbhydra (DB, Logs, config) # Default is same as nzbhydra2_dir/data . /etc/rc.subr name="nzbhydra2" rcvar=${name}_enable load_rc_config ${name} : ${nzbhydra2_enable:="NO"} : ${nzbhydra2_user:="nzbhydra2"} : ${nzbhydra2_group:="nzbhydra2"} : ${nzbhydra2_dir:="/usr/local/nzbhydra2"} : ${nzbhydra2_datafolder:="${nzbhydra2_dir}/data"} pidfile="/var/run/nzbhydra2/nzbhydra2.pid" command="/usr/local/bin/python2.7" command_args="${nzbhydra2_dir}/nzbhydra2wrapper.py --datafolder ${nzbhydra2_datafolder} --pidfile ${pidfile} --daemon --nobrowser" start_precmd="prestart" prestart() { if [ -f ${pidfile} ]; then rm -f ${pidfile} echo "Removing stale pidfile." elif [ ! -d ${pidfile%/*} ]; then install -d -o ${nzbhydra2_user} -g ${nzbhydra2_group} ${pidfile%/*} fi if [ ! -d ${nzbhydra2_datadir} ]; then install -d -o ${nzbhydra2_user} -g ${nzbhydra2_group} ${nzbhydra2_datadir} fi } run_rc_command "$1"
Make rc file readable and start nzbhydra2
iocage exec nzbhydra chmod u+x /usr/local/etc/rc.d/nzbhydra2
iocage exec nzbhydra sysrc "nzbhydra2_enable=YES"
iocage exec nzbhydra sysrc "nzbhydra2_user=nzbhydra2"
iocage exec nzbhydra sysrc "nzbhydra2_dir=/usr/local/share/Nzbhydra"
iocage exec nzbhydra sysrc "nzbhydra2_datafolder=/config"
iocage exec nzbhydra service nzbhydra2 start
NzbHydra2 should now be able at:
http://<JailIP>:5076