by Ginny Henningsen, November 2011
This article explains how I used Oracle VM VirtualBox to save time when testing database installation procedures. Oracle VM VirtualBox proved to be an incredibly useful tool because I could easily create multiple OS installation test cases as well as snapshot my progress at various points along the way.
I'd always thought of Oracle VM VirtualBox as a useful tool for developers who need to port code across different operating environments. Since Oracle VM VirtualBox allows a single machine to host multiple guest operating systems on a single machine, a developer can easily switch operating systems simply by changing between different desktop windows.
As Figure 1 suggests, you can install Oracle VM VirtualBox on Microsoft Windows, Linux, Mac OS X, and Oracle Solaris for x86 platforms, and it can host a number of different guest operating environments: Windows, DOS, Linux, Mac OS X, Oracle Solaris, OpenBSD, FreeBSD, and OS/2.
Figure 1. Host Platforms and Guest Operating Environments
A short time ago, I discovered just how powerful Oracle VM VirtualBox can be as a tool for system administrators. I was recently tasked with the job of testing Oracle Database 10g and 11g installation procedures to document how to use the
oracle-validated RPM package on Oracle Linux. For those who didn't read the article ("How I Simplified Oracle Database Installation on Oracle Linux"), installing the freely available
oracle-validated RPM package automatically performs a number of required tasks, such as installing required software packages, resolving package dependencies, and modifying kernel parameters. I found that using Oracle VM VirtualBox made it easy—and faster—to test and retest installation procedures. I could run multiple test iterations using different operating system versions and different database versions. In addition, I could revalidate procedures and repeat test runs without having to start over completely from scratch.
The experience taught me that using Oracle VM VirtualBox can be quite valuable to system administrators who are learning how to perform tasks in one operating system when the bulk of their expertise is in another. (I confess I know Oracle Solaris better than Oracle Linux.) It is a natural fit for setting up multiple test environments so that you can check procedures, especially since it enables easy recovery and the ability to revert to a known, working state of the operating environment.
Initially I installed Oracle VM VirtualBox on my Oracle Solaris 10 host and set up multiple Oracle Linux guest virtual machines (VMs), as shown in Figure 2. I started by testing the installation of the
oracle-validated RPM package and Oracle Database 10g on a 32-bit version of Oracle Linux 5.6. I then created a new guest VM with the 64-bit version of Oracle Linux 5.6 and repeated the procedure. Since installing the
oracle-validated RPM changes kernel parameters and installed packages, I used the Oracle VM VirtualBox snapshot feature to capture the initial installation state of the Linux guest operating system. By restoring that initial state, I could easily revalidate procedures or modify the installation to use Oracle Database 11g. Towards the end of the project, Oracle released version 5.7 of Oracle Linux, so I simply created another guest VM and retested the installation steps.
Figure 2. Multiple Oracle Linux Guest VMs
At one point in the process, I decided to take advantage of Shared Folders, a feature in Oracle VM VirtualBox that allowed me to use disk space more effectively by having all the guest VMs access database ZIP installation files from a centralized download folder in the host Oracle Solaris OS. Because Oracle Linux ships with the Unbreakable Enterprise Kernel (UEK), setting up Shared Folders on Oracle Linux involved an extra step, which I fortunately discovered from error messages and the Fat Bloke Sings blog (a blog by an active member of the Oracle VM VirtualBox community). This blog is one of the great resources available to Oracle VM VirtualBox users, in addition to the documentation and the open source community (see Resources at the end of this article). The remainder of this article steps through my Oracle VM VirtualBox installation, including setting up Shared Folders on an Oracle Linux guest.
I started by downloading the appropriate Oracle VM VirtualBox installation bits from the download site and following the installation instructions in the User Manual to unzip and install. On my Oracle Solaris 10 system, the install looked like Listing 1 (and installation is even easier on Windows, Mac, and Linux).Listing 1: Installing Oracle VM VirtualBox
# gunzip -cd VirtualBox-4.1.4-74291-SunOS.tar.gz | tar xvf - x VirtualBox-4.1.4-SunOS-r74291.pkg, 247942656 bytes, 484263 tape blocks x LICENSE, 20137 bytes, 40 tape blocks x autoresponse, 151 bytes, 1 tape blocks x ReadMe.txt, 1778 bytes, 4 tape blocks # pkgadd -d VirtualBox-4.1.4-SunOS-r74291.pkg The following packages are available: 1 SUNWvbox Oracle VM VirtualBox (i386) 4.1.4,REV=2011.10.03.16.41.74291 Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: all Processing package instance <SUNWvbox> from </Downloads/VirtualBox-4.1.4-SunOS-r74291.pkg> . . . Installation of <SUNWvbox> was successful.
At this point, I started the Oracle VM VirtualBox application and began creating my first guest OS environment. To define my first guest, I clicked the New button and specified the name of the new guest VM and a couple of parameters: the amount of system memory (RAM) that Oracle VM VirtualBox allocates every time the virtual machine is started and the virtual hard disk that it uses for storage.
Figure 3. Creating a New VM
Once the guest VM is initially defined, it appears in the Oracle VM VirtualBox Manager's list of guests. The first time that you start a new VM, the First Start Wizard pops up, so you can select the installation medium (for example, a CD-ROM or ISO image on the hard disk) to install the operating environment into the VM. After the OS is installed, clicking Start boots the installed OS.
For my testing purposes, I first installed an Oracle Linux 5.6 32-bit guest. I could then experiment with installing the
oracle-validated RPM, which modified kernel parameters and resolved package dependencies for database installation. After that, I installed Oracle Database 10g.
Since I also needed to test the 64-bit version of Oracle Linux 5.6, I created a new guest. By this time, I realized that if I needed to repeat the installation of the
oracle-validated RPM or switch from installing Oracle Database 10g to 11g, it made sense to generate a snapshot of the VM in its freshly installed state. This way, I could start my installation process with a known, pristine operating system.
To create a snapshot, I clicked Take snapshot in the Oracle VM VirtualBox Manager GUI, as shown in Figure 4, which caused Oracle VM VirtualBox to capture the current state of my guest VM in a snapshot.
Figure 4. Taking a Snapshot
By restoring the snapshot, I could quickly revert back to a freshly installed OS, essentially undoing the kernel and package changes that
oracle-validated did during its installation process. This was useful for testing and retesting which repositories I needed to enable before installing
oracle-validated and for installing different database versions on the same OS.
For Oracle Database 11g , the ZIP installation files total over 2 GB. Since I needed to access them from each of the guest VMs to install the database, I decided to take advantage of Shared Folders for Oracle VM VirtualBox. The Shared Folders feature allows a guest VM to access storage in the host file system, so it allowed me to access the same installation files for each VM.
Shared Folders is an add-on capability provided in Oracle VM VirtualBox's Guest Additions. The Guest Additions package supplies device drivers and system applications that augment basic functionality for the guest operating system. In addition to Shared Folders capabilities, Guest Additions contains several OS specific add-ons, such as seamless windowing, mouse pointer integration, and better video support.
Guest Additions for the supported guest OS types are provided in an ISO file located in Oracle VM VirtualBox's installation directory. To install Guest Additions for a particular VM, mount the ISO file in the guest VM as a virtual CD-ROM image (if it's not already mounted) and install it from there. I used a terminal window in my Linux guest and changed directories to the ISO mount point to run the installation script. The first time I tried to install Guest Additions in my Oracle Linux guest VM, the installation failed, as shown in Listing 2.Listing 2: Installation of Guest Additions Failed
# sh ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.1.2 Guest Additions for Linux......... VirtualBox Guest Additions installer Removing existing VirtualBox DKMS kernel modules [ OK ] Removing existing VirtualBox non-DKMS kernel modules [ OK ] Building the VirtualBox Guest Additions kernel modules The headers for the current running kernel were not found. If the following module compilation fails then this could be the reason. The missing package can be probably installed with yum install kernel-devel-2.6.32-100.26.2.el5 Building the main Guest Additions module [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong) Installing the Window System drivers Installing X.Org 7.1 modules [ OK ] Setting up the Window System to use the Guest Additions [ OK ] You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services component[ OK ] Press Return to close this window...
The log file
/var/log/vboxadd-install.log in the output shown in Listing 2 points to missing kernel sources as the problem:
# more /var/log/vboxadd-install.log /tmp/vbox.0/Makefile.include.header:94: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
Thanks to the Fat Bloke's blog, I confirmed the source of the problem. Oracle Linux comes with two kernels: a 100% Red Hat compatible one and the Unbreakable Enterprise Kernel (UEK). My Linux guest was running the UEK, so I needed to install the appropriate
kernel-uek-devel packages for the Guest Additions installation to work properly. This is because the Guest Additions installation needs to build and install kernel drivers. I used these
yum install commands to download and install the missing packages:
# yum update # yum install gcc # yum install kernel-uek-devel (yum output not shown)
This time, the script ran without error, as shown in Listing 3.Listing 3: Installation of Guest Additions Succeeds
# sh ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.1.2 Guest Additions for Linux......... VirtualBox Guest Additions installer Removing installed version 4.1.2 of VirtualBox Guest Additions... Removing existing VirtualBox DKMS kernel modules [ OK ] Removing existing VirtualBox non-DKMS kernel modules [ OK ] Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module [ OK ] Building the shared folder support module [ OK ] Building the OpenGL support module [FAILED] (Look at /var/log/vboxadd-install.log to find out what went wrong) Installing the Window System drivers Installing X.Org 7.1 modules [ OK ] Setting up the Window System to use the Guest Additions [ OK ] You may need to restart the hal service and the Window System (or just restart the guest system) to enable the Guest Additions. Installing graphics libraries and desktop services component[ OK ] Press Return to close this window...
Note that the OpenGL module still failed on the Oracle Solaris host platform (this isn't the case on Windows, modern Linux environments, and Mac OS X), but it wasn't critical or relevant to what I needed to do.
So that I could access a host folder from my Linux guest VM, I first made sure the folder was properly exported for sharing. Then I simply clicked Shared Folders under Details in the Oracle VM VirtualBox Manager window for the guest VM. A pop-up window let me configure the path of the host folder I wanted to access and a folder name that the guest VM uses for the mount point, as shown in Figure 5. It's also possible to set up access to Shared Folders on the command line with a VBoxManage command; see the User Manual.
Figure 5. Setting Up Shared Folders
By default, the guest VM mounts the host folder as
<name> is the name you specify when you create the mount point. For example, after restarting the guest, I could see the contents of the host folder
/media/sf_Downloads in the guest VM. I could now access the downloaded database ZIP files in my guest VM.
Oracle VM VirtualBox turned my simple x86 system into a nonproduction sandbox where I could test installations and validate system administration procedures. The best part is that taking Oracle VM VirtualBox snapshots along the way let me return to a known working operating system state. With the advent of Oracle Solaris 11 on the horizon, I'm sure that creating an Oracle Solaris 11 VM under Oracle VM VirtualBox will be a great hands-on way for me to learn about what's new in that OS. If I ever get to the UK, I need to buy the Fat Bloke a pint to say thanks!
Here are the resources referenced earlier in this document:
And here are some additional resources:
|Revision 1.0, 11/09/2011|