Ottawa PC Users' Group, Inc.
 Product Review 


Exploring Linux – Part 17
by Alan German

Linux has native applications for just about anything, and even specific Windows' programs can often be run using Wine, but there are still a few Windows' packages that refuse to behave “properly” in the Linux world. Now, as we have seen in previous articles in this series, it is easy to set up a dual-boot Linux-Windows system, and hence have the ability to run any misbehaving programs directly under Windows. But, perhaps there is another way to bring these renegades to heel inside of Linux.

Enter VirtualBox, an open-source package overseen by Oracle Corporation, that allows virtual machines using any one of a number of operating systems, including Windows, to be setup in the Linux environment. Of course, one needs a copy of the Windows' operating system of choice (e.g. Windows XP) in order to make this happen but, after that, it's a fairly straightforward process to run Windows – and hence Windows' programs – inside Linux.

There are downloadable versions of VirtualBox available for many Linux distros; however, for Ubuntu, the simplest way to install the correct version of the software is to use Synaptic Package Manager. Just search for virtualbox, mark the open-source edition (OSE) for installation, hit the apply button and, after a few minutes, VirtualBox is ready to use.

Now, you could run VirtualBox from a terminal window but it's more convenient to add a program launcher to the applications menu. Navigate to System – Preferences – Main Menu – System Tools and add the launcher to this menu item using Command = virtualbox.

Now the fun begins. Running the program brings up the VirtualBox OSE window. The first thing we need to do is to create a virtual machine by clicking on the “New” icon to launch the New Virtual Machine Wizard. The first screen prompts for a name for the virtual machine so you can enter something really esoteric such as “Windows XP”. By default, the OS type and version are set to Microsoft Windows, and Windows XP, respectively. The subsequent settings can essentially be left at their default values, so that we assign 192 MB of memory to the virtual machine, and create a new bootable hard disk, initially with 10 GB, but with dynamically expandable storage, and named Windows XP.vdi.

We are almost ready to load an operating system on our virtual machine. But, here is the first trick. We need to enable the CD/DVD drive in the virtual machine so that it will be able to read data from our master disk. We click on the “Settings” icon and then navigate to Storage – the CD icon (currently marked as Empty) – and set the CD/DVD Device to the physical host drive present on our system.

With a copy of the Windows XP distribution disk inserted into the CD drive, we now press the “Start” icon and the virtual machine roars into life with a Windows XP installation in process. Now, it's just a matter of being patient, answering the prompts as they arise, including entering the serial number associated with your copy of Windows XP, and letting the installation reach completion. The VirtualBox window now displays a running version of Windows XP, as shown in the screenshot below, where both Windows Explorer and Notepad are in use on the virtual machine.

There are a few more features (and “tricks) worthy of note with the operation of the virtual machine (VM). One such item is that the mouse and keyboard may be assigned to the host machine and/or the virtual machine, and their status is subject to somewhat confusing warning messages.

When first starting the VM, a warning message indicates that the “Auto capture keyboard” option is turned on such that the VM will automatically take control of the keyboard and all keystrokes will be directed to the VM rather than to the host machine. The message further states that the mouse and keyboard status may be toggled using the “Host key” (the Ctrl button on the right side of the keyboard). However, a subsequent message indicates that the guest OS (Windows XP) supports “mouse pointer integration” that automatically “uncaptures” the mouse when it is used on the VM.

For Ubuntu users running a Windows XP VM, the above doesn't seem to be much of a concern. By default, both devices are initially operative on both machines. Pressing the host key does indeed causes the host machine (Ubuntu) to take control of the keyboard such that text can no longer be entered in applications running in Windows XP. However, toggling the host key once again, or simply clicking the mouse inside the VM's window, re-enables use of the mouse and keyboard on the VM.

A very useful feature, if you find the VM's window to be too small, is that it can be easily be resized by right-clicking on the VM's desktop and adjusting Properties – Settings – Screen resolution, just as you would on a real Windows' machine.

One final trick for use in our first exploration of VirtualBox is to enable a means to exchange files between our Ubuntu host and the virtual Windows XP machine. Now, this may seem like a bad idea given that a major benefit of using a virtual machine is that it is isolated from the real system and, once shut down, it effectively disappears from the planet. However, we will need to install those misbehaving Windows' applications, and it may not be convenient to do so by first loading them onto a CD – which is currently our only access to the virtual machine for loading operating systems – and software packages!

It may seem reasonable that such file exchange should be accomplished using the now ubiquitous USBkey; however, from information gleaned from the web, support for USB devices in VirtualBox seems to fraught with difficulties. Another option is to set up a shared folder on the Ubuntu host that can be accessed by the VM. This process is also not all that intuitive, but a little web-based assistance proves to be very worthwhile.

In particular, there is an excellent how-to Youtube video (
http://www.youtube.com/watch?v=_5f1p3fZJPc) on the subject from David Steinlage of http://davestechsupport.com that gives precise instructions. In effect, you need to create a folder in the Ubuntu file system, point to this folder as a shared folder in the VM, and map it as a network drive with an appropriate drive letter for use by Windows.

With the VM running, the main trick is to use the Devices – Shared Folders menu item in the VM's window, and then find the tiny icon – a folder with a plus sign – in the right side bar that is the “Add shared folder” option. Using the drop-down menu for the folder path, select “Other...” and browse for the shared Ubuntu folder. Next, be sure to check “Make Permanent” so that the shared folder will be available each time you run the VM. Checking the “Read-only” box is optional, depending on whether or not you wish the VM to be able to write (i.e. store) files to the shared folder.

Once the shared folder has been defined, the final step is to go into the virtual machine itself, select Start – My Computer – Tools – Map Network Drive, assign a drive letter (the default is drive z:), and browse for the shared folder. This will be found under something like Virtual Box Shared Folders – \\Vboxsvr\vboxshared.

Now if you wish to install a Windows' application in the VM, all you need to do download the installation file, store it in the shared folder on the Ubuntu machine, run the virtual machine, use Windows Explorer to open the mapped drive z:, and double-click on the file to start the installation process.

And that's about all you need to know to get started in order to run Windows programs in a “virtual box”!


Bottom Line:

VirtualBox (Open Source)
Oracle Corporation
http://www.virtualbox.org/

Click here to view the full OPCUG website with frames.

Copyright and Usage
Ottawa Personal Computer Users' Group (OPCUG), Inc.
3 Thatcher Street, Ottawa, ON  K2G 1S6

The opinions expressed in these reviews do not necessarily
represent the views of the OPCUG or its members.

Send comments or suggestions to the .