I am using Vagrant with Virtualbox for many years to automate test environments on my notebook. I absolutely love it, it allows me to spin up Solaris and Linux virtual machines in any way I need it. If you also have a need for a very convenient and affordable LAB environment, give it a try.
There is an additional challenge if you want to use Solaris VMs. Because there are no prepared Solaris base images (aka
boxes), which you could just download from the web. I assume it is legally not allowed to redistribute Solaris.
Luckily Solaris has already a very powerful technology for handling OS images
Unified Archives (UARs), which you likely use already for your OS deployment. In this post I will show how you can convert a Unified Archive hands-free in approximately 10 minutes into a Vagrant
Last year Alan Chalmers published how to use the open source software “Packer” to create Vagrant boxes out of Solaris GA installation ISOs. I am building on this great work and extended it to use
Unified Archives. I covered the installation of Solaris with UARs already in a previous article, the following Packer recipe does basically the same, but highly automated.
The method has several advantages:
- Same image like in production, same SRU, same configuration, etc
- SMF sysconfig profile can be used for clean re-configuration, like changing the hostname
- Automated Installer (AI) manifest can be used for customizations, like changing the swap device, etc
- Cleaner and more robust Packer configuration (e.g.: boot_command)
- Plus all advantages of
First you need a UAR of your golden/master Solaris installation, with your customizations, like packages, patches, SRU, etc.
# archiveadm create /data/gold-image-v1.uar
When you have your archive file, you need to convert it first on Solaris to a boot-able ISO image:
# archiveadm create-media --format iso gold-image-v1.uar Initiating media creation... Preparing build environment... Adding archive content... Image preparation complete Creating ISO image... Finalizing /data/AI_Archive.iso... Cleaning up...
When you have the iso file, check the paths and checksum in
Then you can execute
packer build. Quickly summarized, Packer boots a Virtualbox VM with the ISO, starts a web server to serve the AI manifest and the SMF sysconfig profile. Simulates keypresses for the special boot command and installs Vagrant specific stuff like Virtualbox Guest Additions and known Vagrant public key.
$ packer build -only=virtualbox-iso solaris-ai.json ... ==> Builds finished. The artifacts of successful builds are: --> virtualbox-iso: VM files in directory: packer-solaris11-ai-virtualbox --> virtualbox-iso: 'virtualbox' provider box: ./builds/virtualbox/solaris11_ai.box
When you execute the command you can lean back and watch how Packer creates your
box. On my notebook with a flash disk, the build was finished in 12 minutes.
Finally your Vagrant Solaris base box is ready to use:
$ vagrant box add builds/virtualbox/solaris11_ai.box
If you like you can further customize the installation in the AI manifest
http/manifest.xml and the SMF sysconfig profile
http/profile.xml. The Packer recipe
solaris-ai.json also contains a configuration for VMware, which should work, however I didn’t have the possibility to test it.