If you haven't used iohyve before I recommend you look at the youtube video and take some notes
https://www.youtube.com/watch?v=rCDh9K16Q5QPrerequisites- Decide which storage pool iohyve and the VMs will reside in
- Enable terminal access on FreeNAS root account (you can disable it later if desired)
- Need the network interface identifier in FreeNAS
- Might need an app to access the terminal service. I use pUTTY
Need to add some images of the freenas UI (for pool name and network interface details)Access the FreeNAS server via a terminal session using the root account
Inital Setup of iohyve on FreenasThis can be skipped if iohyve is already configuredThe command to configure the hypervisor is
iohyve setup pool = {storage pool name} kmod = 1 net = {Network Interface}In my case the pool is name “MacJones_pool1” and the network interface is “lagg0” the command is
[/list]
iohyve setup pool = MacJones_pool1 kmod = 1 net = lagg0
Set some FreeNAS tunablesThis will ensure the iohyve setup is enabled on a restart of the FreeNAS server.
It can be skipped if iohyve has already been configured / tunables are already presentThe entry related to net=lagg0 should be changed to refer to the network interface specified in the iohyve installation
Variable | Value | Type |
iohyve_enable | YES | rc.conf |
iohyve_flags | kmod =1 net=lagg0 | rc.conf |
Need to add some images of the freenas UI (Tunables section)Fetch the operating system that will be used on the virtual machineiohyve must have the OS image available before it can be used to build a VM. In this case I used the debian 8 OS as that is the default / recommended distro for mediacenter
You can fetch it from a local respository or from the internet. In my case I already had it available on the FreeNAS server
The command is
iohyve fetch {location}iohyve fetch /mnt/MacJones_pool1/ISOImages/debian-8.6.0-amd64-netinst.iso
Pulling it directly from the debian site should be as simple as getting the url for the most recent debian 8 version & then executing the iohyve fetch command. As an example
iohyve fetch http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-8.7.1-amd64-netinst.iso
**Note the current version is more recent than the one I had locally
Define the Virtual MachineThis sets the VM name and the disk allocation
The command is iohyve create {name} {disk allocation}
In my case I named the VM "deb64vm003" and wanted 32GB of disk. The command was
iohyve create deb64vm003 32G
Set the VM's attributesThis set the VMs attributes (CPU, RAM, OS type, Loader). It done via the iohyve set command and can be issued individually or as a group. In my case I allocated 2 CPU, 4GB RAM, set the OS to be debian, set the boot loader to grub_bhyve & set the description to JRiver MediaCenter
The command syntax is
iohyve set {vm name} {one or more attribute / value pairs}In my case
iohyve set deb64vm003 ram=4096 cpu=2 os=debian loader=grub-bhyve description= jRiver_Media_Center
Build / Configure the VMNext we have to get iohyve to install the OS onto the VM. This is done using the iohyve install command. The syntax is
iohyve install {VM name} {image name}In my case the vm = deb64vm003 and the image = debian-8.6.0-amd64-netinst.iso
iohyve install deb64vm003 debian-8.6.0-amd64-netinst.iso
To complete the OS installation you need to start another terminal session (as root) with the FreeNAS server and open the iohyve console for the VM. The command for the console is
iohyve console {VM name}iohyve console deb64vm003
Complete the debian 8 installation (it will take some time - especially if slow internet connection). Of note
- I make the hostname the same as the VM name
- Choose a good mirror. In Australia I use the iiNet mirror
- As part of the install choose xfce and ssh
- I get the install to create an account named ‘jriver’
Once the installation has completed OK......
Set the VM so that it automatically starts The command is
iohyve set {VM name} boot=1iohyve set deb64vm003 boot=1
Start the VMThe iohyve command is
iohyve start {VM Name}iohyve start deb64vm003
At this stage the VM should be OK. There is no graphical console (yet). Access is via a terminal session
- Test that you can access the Vm via a terminal session
- Restart FreeNAS to ensure iohyve and the VM start on reboot
Useful iohyve commandsiohyve list: lists all defined VMs & current status
[root@freenas] ~# iohyve list
Guest VMM? Running rcboot? Description
deb64vm003 YES YES YES jRiver_Media_Center
deb64vm004 YES YES NO Wed Jan 25 08:37:29 AEDT 2017
[root@freenas] ~#
iohyve getall {vm name} - lists all the attributes set for that vm
[root@freenas] ~# iohyve getall deb64vm003
Getting deb64vm003 iohyve properties...
20160122 20160122
bargs -A_-H_-P
boot 1
con nmdm0
cpu 2
description jRiver_Media_Center
install no
loader grub-bhyve
name deb64vm003
os debian
persist 1
ram 4096
size 32G
tap tap0
template NO
vnc NO
vnc_h 600
vnc_ip 127.0.0.1
vnc_tablet NO
vnc_w 800
vnc_wait NO
[root@freenas] ~#
iohyve start {vm name} - starts the specified VM if not already running
iohyve stop {vm name} - stops the specified VM
iohyve console {vm name} - starts a terminal session with the VM's console