evelopers, QA engineers, and build managers alike are finding many uses for virtualization products in today's IT environments. The department I work in as a senior software engineer has standardized on virtualization technology such as VMware's Workstation and Server products for our development needs. One of the main areas that virtualization has really helped us is in our build process.
Traditionally, a build manager installs a fresh operating environment on a designated piece of hardware and lays all of the prerequisites for the organization's build on top of this clean environment. These prerequisites can include technologies such as Java, ANT, Maven, Visual Source Safe, and any number of required third-party utilities and libraries. The build manager then must maintain the integrity of that environment throughout the build process. This is where virtualization products can aid the build manager and make his or her job much easier.
With desktop or server virtualization products (such as VMware Workstation or VMware Server, respectively) you can set up a clean build environment inside the virtual machine. The build environment is not only independent of the host environment, but it also is easy to back up and port to new hardware. This article walks you through using virtualization products, namely VMware Workstation and VMware Server, in your build process.
Installing Your Build Environment on a VM
VMware Server is a freely available product, while VMware Workstation requires that you purchase a license for the host operating system (OS) on which you install it. Using VMware Workstation over VMware Server has some benefits (more on that later), but if you haven't used virtualization technology before, VMware Server is an excellent place to start. Download it here.
VMware Server allows you to create a virtual machine that can run on any Windows or Linux host. VMware also has a version of Workstation that can run on a Mac. (Learn more about the Mac version here.) If, for example, your build process requires Windows Server 2003, you can install VMware Server on your host machine and then create a Windows Server 2003 virtual machine. Even though my build process requires Windows Server 2003, I'm running Ubuntu Linux as my host OS. For guest operating systems, VMware Server and Workstation support all current versions of Windows, most of the popular Linux distributions, Solaris, and Novell Network. They also provide an option for "other" in case your guest OS isn't officially supported.
Installing a guest OS with VMware Server is no different from installing an OS on the native hardware. Using a wizard, you can set the parameters of your guest operating system, such as:
- Which OS type you're going to install (see Figure 1)
|Figure 1. Select Your Guest OS Type:|
You can set the type of your guest operating system.
- How much disk space you allocate to the VM (see Figure 2)
|Figure 2. Select the Amount of Disk Space to Allocate to the VM:|
You can set the disk space allocation for your guest operating system.
- The type of networking to use (see Figure 3)
|Figure 3. Select the Type of Networking to Use:|
You can set the type of networking for your guest operating system.
My Windows Server 2003 build environment requires quite a bit of memory and disk space; I set the memory to 2 GB of RAM and allocated 25 GB of hard disk space. You will have to determine how much of each your environment needs. Just remember that the host machine has to have more than the values you set. You can change these values later if necessary.
After you have created your new VM, you then boot a virtual environment into it like you would run a build environment on the host machine. One nice feature in both VMware Server and VMware Workstation is the ability to mount an ISO image and use it as a virtual CD or DVD drive. This feature makes installing your products quite convenient, as you don't have to have the physical media. After you install your operating system, install the VMware tools. These drivers will make your virtual machine run faster.
After installing the base operating system, install and configure all of the prerequisites for your build process. Our build, for example, requires Java, ANT, CA Software Change Manager for Distributed (formerly CA Harvest Change Manager), JBoss, and SQL Server. (CA Software Change Manager for Distributed is a source code management system similar to Visual Source Safe.) I typically pull the necessary configuration files from Harvest and set up the build environment specifically for that VM. I use an ANT properties file that our ANT script will use to drive the build. No other configuration is required, as ANT will download the appropriate third-party libraries and configure all of the build paths for us during the build.