Speak
Clear All
I developed a small script without pretensions, that allows to easily create jails of FreeBSD, Debian GNU/kFreeBSD and ArchBSD type on a FreeBSD host. It is written in sh but is not competitive with ezjail or vmrc. On the other hand it saves no time if your need is easily deploy other than FreeBSD jails.
Prerequisites
You will need to install the following packages (from pkgng or ports):
Perl5 (for debootstrap)
debootstrap (for debian template)
Pacman (for the archbsd template)
git (to retrieve mkjl, optional)
rsync (mkjl dependency)
And to rotate the jails Debian, you will need to load the modules fdescfs and linprocfs.
Installation of the prerequisites
Installation of packages:
# pkg update & pkg install git perl5 debootstrap rsync pacman
Load modules for Debian:
# kldload fdescfs
# kldload linprocfs
Or, in a persistent manner:
# echo fdescfs_load = “YES” > /boot/loader.conf
# echo linprocfs_load = “YES” > /boot/loader.conf
Recovery of mkjl.sh
With git:
# git clone https://github.com/src386/mkjl
Without git:
Just with the archive compressed:
fetch – No.-verify-peer https://github.com/src386/mkjl/archive/master.zip
unzip master.zip
Use
Use the following syntax:
#./mkjl.sh $name $template
For example, to a jail of type ArchBSD named www:
#./mkjl.sh www t_archbsd
Then you’ve to edit /etc/jail.conf to declare your jails. A jail.conf.example file is provided but you can also help you in this article…
Available templates
t_freebsd10: FreeBSD 10-RELEASE
t_debian7: Debian GNU/kFreeBSD Wheezy
t_debian8: Debian GNU/kFreeBSD Jessie
t_archbsd: ArchBSD