Beginning with 9.2.0, FreeNAS® uses the warden templating system to provision jails. When you select the type of jail when creating a jail, as seen in Figure 10.2a, you are really choosing which existing template to use.
To view the default templates, click Jails → View Jail Templates. A listing of the default templates used by a 9.2.2 system are seen in Figure 10.3a.
Figure 10.3a: Listing of Default Jail Templates
The listing contains the following columns:
- Name: will appear in the "type" drop-down menu when adding a new jail.
- URL: when adding a new jail, the template will be downloaded from this location.
- Instances: indicates if the template has been used to create a jail. In this example, no templates have been used to create a jail, so all of the instances are set to 0.
Creating Your Own Templates
Creating your own custom templates allows you to deploy different versions and architectures of FreeBSD or different 32-bit Linux distributions into a FreeNAS® jail. Additionally, the template can be pre-configured to include the applications, configurations, and user accounts that you need in order to quickly deploy your jails.
To create a template, first install the desired FreeBSD or Linux operating system and configure it the way you want. The installation can be either performed either in an existing jail or in a virtual machine.
NOTE: if you are installing Linux, be sure to install the 32-bit version of the operating system as 64-bit Linux versions are not supported at this time.
Once your configuration is complete, you need to create a tarball of the entire operating system that you wish to use as a template. This tarball needs to be compressed with gzip and end in a .tgz extension. Be careful when creating the tarball as you don't want to end up in a recursive loop. In other words, the resulting tarball needs to be saved outside of the operating system being tarballed, such as to an external USB drive or network share. Alternately, you can create a temporary directory within the operating system and use the --exclude switch to tar to exclude this directory from the tarball. The exact tar command to use will vary, depending upon the operating system being used to create the tarball.
Once you have the .tgz file for the operating system, save it to either an FTP share or an HTTP server. You will need the associated FTP or HTTP URL in order to add the template to the list of available templates.
To add the template, click Jails → Add Jail Templates which will open the screen seen in Figure 10.3b.
Figure 10.3b: Adding A Custom Jail Template
Table 10.3a summarizes the fields in this screen.
Table 10.3a: Jail Template Options
|Name||string||value will appear in the Name column of View Jail Templates|
|OS||drop-down menu||choices are FreeBSD or Linux|
|Architecture||drop-down menu||choices are x86 or x64; x86 is required if Linux is selected|
|URL||string||input the full URL to the .tgz file, including the protocol (ftp:// or http://)|