Building Test Environments with Oracle VirtualBox

Date: 8/9/2016
Author: Shan Baugher

Testing with Oracle VirtualBoxEveryone has been in a situation where they needed a test environment and we all know physical test environments can prove to be costly to implement and maintain. Oracle VirtualBox provides a free, easy to install, desktop virtualization tool that is available for Windows, OS X and Linux. VirtualBox allows users to run just about any operating system on a single machine in a virtual environment and switch between any operating systems you may have running without rebooting. Virtual machines are computers that are completely software based. The software based virtual machine runs as a ‘guest’ on a standard computer, or physical ‘host’. The ‘guest’ machine utilizes the physical resources (CPU, RAM, Storage, etc.) of the ‘host’ computer.

My first experience with a virtual machine was in college. I needed to become familiar with Linux as all the computers in the lab were Linux based. Virtualization allowed me to work in one environment and play in the other simultaneously by running Linux inside of Windows. Virtualization software has come a long way since then. For many years now, VirtualBox has been one of the best tools in my bag for a multitude of tasks, including testing upgrades, patches to mock implementations and development purposes. I have even gone as far as building a complete virtual environment with multiple hosts running multiple guests and shared SAN storage. The possibilities are endless.

More recently, I was tasked to create an automated process for configuring the storage for one of our clients. I could not test against the production environment, for obvious reasons. So… enter VirtualBox!

My process for implementing VirtualBox is as follows…

Configured the initial environment.

The virtual environment consisted of a virtual Linux server and a virtual SAN appliance. I imported them into VirtualBox, made a few adjustments and had the environment up in a fraction of the time it would take to actually build it out.

Took a snapshot of each machine in it’s current state and saved them, prior to making any changes.

Developed the script and tested it.

Each test of the script would alter hardware profiles and configuration files on each machine.

Restored the snapshots of the machine’s original state.

I was able to get back to ‘square 1’ by reverting to the snapshots. Reverting to the snapshot removed any changes made during the testing (saving me lots of time from performing manual cleanup) and providing me with a clean slate for future testing.

Cloned both VMs.

I re-purposed VMs for a new project needing a similar environment.

VirtualBox is full of time saving features, including snapshots, cloning, and for the use of virtual appliances, just to name a few.

Snapshots

Snapshots are one of the most valuable features provided by virtual appliances. They allow you to capture the machine’s state at a particular point in time and restore the VM from the saved state(s) or merge the changes made at any time. You can even take multiple snapshots of a machine, creating a trail of breadcrumbs as you make changes to the machine’s state.

Cloning

Cloning allows you to re-purpose your previously developed virtual machine for another project. Don’t waste time building a new one, just clone it!

Virtual appliances

Virtual appliances are pre-configured servers that allow you to quickly spin up a complex system or complete environment in a matter of minutes. There are plenty of sites dedicated to providing virtual appliances with specific purposes in mind.

VirtualBox has become an indispensable tool in my shed that I use on a daily basis. Over time I have collected quite the VM library that I am able to refer to when in need of a test environment. I’ve been able to easily export and share the VMs with others in need of similarly configured machines. VirtualBox is a quick and easy platform for a test environments… Did I forget to mention that its free!!

Check it out… https://www.virtualbox.org/

About the author

Shan Baugher, Systems Administrator
Shan Baugher began working with Eagle in 2012 and is responsible for initiating, architecting, and managing complex IT infrastructures for clients, as well as the offices at Eagle’s headquarters. With over 8 years of project management and systems administration experience, Shan is well-versed in managing virtual environments of all shapes and sizes. He holds an assortment of Professional Microsoft Certifications including MCSE, MCSA, MCP, and MCTS and is also Certified as a Specialist in Oracle VM 3.0 for x86 implementation.