HOWTO freenas 11.1 U2 Iocage Jail Install


Recommended Posts

 

Working on the iocage install and it appears to be running fine, but still can't access the webui
Crossposting on the freenas forum as well
Here's what I'm doing:
 
Initial setup
# make temp file that will cause iocage to install some packages
echo '{"pkgs":["ca_root_nss"]}' > /tmp/pkg.json
# create jail
iocage create -n "rslsync" -p /tmp/pkg.json -r 11.1-RELEASE ip4_addr="vnet0|yourip/24" defaultrouter="routerip" vnet="on" allow_raw_sockets="1" boot="on"
# remove the temp file
rm /tmp/pkg.json

 

 
 
Data directory config
# map config and data storage outside of jail
iocage fstab -a rslsync /mnt/syncdatadirectory /mnt/syncdata nullfs rw 0 0
iocage fstab -a rslsync /mnt/syncconfigdirectory /config nullfs rw 0 0
# link python
iocage exec rslsync ln -s /usr/local/bin/python2.7 /usr/bin/python
iocage exec rslsync ln -s /usr/local/bin/python2.7 /usr/bin/python2

 

 
actual install of resilio
# download and unpack resilio from website
iocage exec rslsync mkdir /usr/local/rslsync
iocage exec rslsync "fetch https://download-cdn.resilio.com/stable/FreeBSD-x64/resilio-sync_freebsd_x64.tar.gz -o /usr/local/rslsync/"
iocage exec rslsync "tar -xzvf /usr/local/rslsync/resilio-sync_freebsd_x64.tar.gz -C /usr/local/rslsync/"
iocage exec rslsync rm /usr/local/rslsync/resilio-sync_freebsd_x64.tar.gz

 

 
 
user and directory setup
# add rslsync user using pid:uid used by rslsync in the past
iocage exec rslsync "pw user add rslsync -c rslsync -u 817 -d /nonexistent -s /usr/bin/nologin"
# change ownership of config and data directories
iocage exec rslsync chown -R rslsync:rslsync /mnt/syncdata /config
# Link the rslsync config file to one from config directory outside of jail
##if using an old btsync install in your config dir copy the old config to new one
#iocage exec rslsync cp -s /config/btsync.conf /config/sync.conf
iocage exec rslsync ln -s /config/sync.conf /usr/local/etc/sync.conf
# create the run command directory and file
iocage exec rslsync mkdir /usr/local/etc/rc.d
iocage exec rslsync "ee /usr/local/etc/rc.d/rslsync"

 

 
 
Put the following into the rc.d file
#!/bin/sh
#
# PROVIDE: resilio
# REQUIRE: LOGIN DAEMON NETWORKING
# KEYWORD: shutdown
#
# To enable Resilio, add this line to your /etc/rc.conf:
#
# resilio_enable="YES"
#
# And optionally these line:
#
# resilio_user="username" # Default is "root"
# resilio_bin="/path/to/resilio" # Default is "/usr/local/share/rslsync"

. /etc/rc.subr

name="rslsync"
rcvar="resilio_enable"

load_rc_config $name

required_files=$resilio_bin

: ${resilio_enable="NO"}
: ${resilio_user="rslsync"}
: ${resilio_bin="/usr/local/sbin/rslsync"}

command=$resilio_bin

run_rc_command "$1"

 

use esc to get out of the editor and exit+save by pressing 'a' twice
 
 
finalizing setup and startup
#move the executable from rslsync to sbin
iocage exec rslsync mv /usr/local/rslsync/rslsync /usr/local/sbin/
# make the run command file executable
iocage exec rslsync chmod u+x /usr/local/etc/rc.d/rslsync
#enable start up of rslsync and start
iocage exec rslsync sysrc "resilio_enable="YES""
iocage exec rslsync service rslsync start

 

 
 
to get around vnet errors that current version of freenas seems to be causing(not sure if this is needed for sync or not)
iocage exec rslsync 'sysrc ifconfig_epair0_name="epair0b"' 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.