Building Mac test environments with VMWare Fusion, NetBoot and DeployStudio
When new software appears, Mac admins need test boxes that match their standard configuration in order to verify that the new software doesn’t adversely affect anything in their environment. In the past, this has usually meant that admins needed to either have an available test box, or go find one when they needed to test something.
The advent of good virtualization solutions meant it was easier to build test boxes without needing additional hardware, but getting the VM to match your standard could take some time and effort.
In VMWare Fusion 5.x, VMWare added NetBoot support for virtual machines running Mac OS X. This proved to be an enormous boon to Mac admins who used NetBoot to help set up their machines: They could now build VMs using the exact same processes that were used to build their users’ Macs. They could also leverage tools like createOSXinstallPkg to set up template VMs with either the latest available OS X installer from the Mac App Store or custom builds of OS X that ship with new hardware.
See below the jump for an example of how you can leverage VMWare’s NetBoot support, createOSXinstallPkg and DeployStudio to set up a new Mac VM with a factory-fresh install of OS X Mountain Lion.
Pre-requisites:
createOSXinstallPkg-built Mountain Lion installer package
VMWare Fusion 5.0.2 or higher
DeployStudio NetBoot drive running 10.7.x or higher set as default NetBoot set
Before anything else, you’ll need to set up a DeployStudio workflow that will allow the createOSXinstallPkg-built 10.8 installer to be installed as a non-postponed installation. I have a post on how to do that here:
Once you have that built, let’s set up a VM with a completely empty boot drive.
Configuring the VM
1. Launch VMWare Fusion 5.x
2. In VMWare Fusion, select New… under the File menu to set up a new VM
3. In the Create New Virtual Machine window, select Continue without disc
4. In the Installation Media window, select Create a custom virtual machine
5. In the Choose Operating System window, set OS as appropriate. In this example, I’m setting it as follows:
Operating System: Apple Mac OS X
6. In the Finish window, select Customize Settings
7. Save the VM file in a convenient location.
8. In your VM settings, select Network Adapter.
9. In the Network Adapter settings, select Autodetect under Bridged Networking
Note: You may also want to adjust the VM’s available RAM in the Processors & Memory settings at this point, but that’s up to you.
The VM is now configured. It’s set up for OS X 10.8.x, but has a formatted and completely empty boot drive.
Booting to DeployStudio
1. To boot the VM from the DeployStudio boot set, start the VM and then do nothing.
If the DeployStudio boot set is set as the default boot set on the NetBoot server, the VM should boot to DeployStudio automatically after failing to boot from the VM’s hard drive or CD-ROM.
2. Once booted to DeployStudio, log in as you normally would.
3. Select the workflow with your 10.8 installer.
4. Run the workflow to install the 10.8 installer onto the VM’s empty boot drive.
5. When the workflow is finished, hit the Quit button.
The VM will restart from its hard drive and automatically install 10.8 on the VM’s boot drive. Once finished, you’ll have a factory-fresh install of 10.8.x on your VM.
VM Customization
The example described above will set up a VM with only OS X 10.8.x installed, but you can customize further. Depending on your process, you could reboot back to DeployStudio and run additional workflows on the VM.
Another approach would be to modify the createOSXinstallPkg-built 10.8 installer to add additional packages. This would allow you to add a systems management agent like Casper, Munki, Puppet or others to the 10.8 OS installer. Once the agent reported in, the systems management tool could have its agent install additional software and scripts to configure the VM.
If your workflow is built around laying down an image with DeployStudio, you can also use DeployStudio to install that image in your VM. In this case, you would be treating the VM like you would any other physical Mac.
DeployStudio Netboot set needs to be 10.7+, which shouldn’t be an issue if someone is rolling this out fresh.
Good catch. I’ve added that in the pre-requisites section.
Not to be ‘too cool for school’, but… in VMWare 4 if you
were booted from the temp disk image Install Mac OS X Lion.app
creates as if you were setting up the VM from scratch, you can just
pop open Disk Utility from the Utilities menu and restore any image
you want…either by logging into a sharepoint and then using asr on
the command line or using DU’s restore interface. (Yes, I just need
to have work buy me the upgrade so I can netboot, I’ve been
lazy)
True. Prior to NetBoot being available, I was using a small VMWare VM that had been set up as a DeployStudio boot set, then attaching the DeployStudio boot VM’s virtual hard drive to new VMs as needed.
For people who might want to do this with VMWare Fusion 8 there are a few additional steps. I found this very useful article on: http://www.macinfo.info/?p=41
After you create the virtual machine, you have to modify the VMX file of your Virtual Machine (show package contents of your virtual machine wherever it is located) – I recommend XCode or Atom.
Add the following lines to the bottom of the file:
board-id.reflectHost = “FALSE”
board-id = “MAC-F22589C8″
hw.model.reflectHost = “FALSE”
hw.model = “MacBookPro6,2″
serialNumber.reflectHost = “FALSE”
serialNumber = “************″
smbios.reflectHost = “FALSE”
SMBIOS.use12CharSerialNumber = “TRUE”
Modify the Serial Number above and ensure you delete the one duplicate entry “serialNumber.reflectHost =”True” “.
Turn the virtual machine on and presto, you are NetBooting.
None of the above information is necessary to enable NetBooting, though it looks useful if you want to pre-provision a VM for DeployStudio to configure it.
I was personally unable to get NetBoot to work as it failed to find anything on the EFI Network. Granted I choose mac OS 10.12. It seemed to work after making the following changes. I will retry again without it and see if it works or not.