Imagine being able to run Linux programs and Windows at the same time on the same machine. No, I’m not talking about Wine, the Windows emulator. I’m talking about running genuine Windows XP as an application under Ubuntu.
Well, Imagine no more. If you look at the screen capture to the left you’ll see the Ubuntu desktop. You’ll see a window with XP running in it and Street Atlas running under XP. You’ll see the XP window, called “winders” on the Ubuntu task bar circled in Blue. At the same time, Forte Agent mail agent is running under Wine, its tab being circled in Red.
Amazing, no? All that is brought to you by the power of VmWare . (that web page is horrible so unless you just like to waste bandwidth, don’t bother.) VMware is an executive that runs under a host system (Ubuntu in this case) and creates 1 or more virtual machines (VMware calls them appliances) that other operating systems can run under. One could have multiple copies of windows, windows and a different distro of Linux or even multiple copies of Ubuntu running under Ubuntu. Dizzying, isn’t it?
A virtual machine gets its own memory and disk drive space and all the other resources an OS normally expects. The XP that is running in the above screen capture was installed from the XP disk that came with my computer. In other words, it’s the real thing and not an emulation.
This is a blow-up of the lower right corner of the VMware window, the window that contains XP. Each of the little icons is a resource. A disk drive, a CD drive, a scanner and so on. Each resource can be turned off or on at will. If I turn on a disk drive, windows responds with a “found new hardware” bubble and installs that hardware. IOW, it doesn’t know the difference between a real and a virtual resource.
Another exciting feature is the ability to drag and drop things between the XP window and Ubuntu. In fact, that’s how these photos were brought to this post. I write my blog entries using a program called BlogDesk. It is a windows program that will not run under Wine. It runs just fine in a virtual machine running XP. I did the screen captures using Ubuntu’s screen capture utility and the dragged the images from the Ubuntu desktop to the XP desktop. Slick.
Vmware is in the business of selling very high dollar products to big corporations but they have a few things for us little guys and most are free.Â If you follow this guide, you can set up a virtual machine for free.
There are several concepts that are critical to understanding how this works:
- Appliance – An appliance is a virtual machine.Â Physically, it consists of a minimum of two files – a file containing the disk drive for the virtual machine and a configuration file.Â When the configuration file is “run”, the virtual machine is started up.Â The operating system and all data files are contained in that one native machine “disk drive” file.Â Appliances can be built or they can be downloaded pre-built from the Appliance Store.Â For our purposes, the store isn’t of much use because pre-built Windows machines can’t be distributed.Â M$ wouldn’t like that.
- Appliance Marketplace – this is a place  on the VMware website where pre-built appliances can be downloaded.Â Contrary to the name, these downloads are free.Â Most all of these are Linux-oriented and thus of little use to us since we want a windows virtual machine appliance.
- Server.Â The Server  The server is a free product designed to allow one to built multiple servers on one hardware.Â We don’t need to do that.Â What Server DOES do that we need is that it can build an XP appliance for us.Â It’s a huge download (almost a gigabyte) but necessary.
- Player Player  is a (in our case) Linux application that actually runs the VM appliance.Â It is also free.Â What you see in the screen shots above is Player running the XP virtual machine Appliance.
- Appliance Builder This is the software and process of building an appliance.Â That is, creating a virtual machine and loading it with an operating system, in our case XP.Â Server is one builder.Â Another is this.  I haven’t tried this but it is reported to work well.
- VMware Tools. This is a suite of tools that is installed on the virtual machine that enables several important functions such as drag and drop.Â Tools are installed after the VM is created and the OS installed.Â if you build your windows appliance using Server then you’ll have the opportunity to install the tools as part of the process.Â If you use the appliance builder website mentioned above, then you’ll want to read this. 
Things to Download
To get started, you’ll need to download some things.Â We’re going to create a VM using Server so you’ll need the following:
- Server.Â You have to register and get an activation key so I can’t provide a link here.Â This is a huge download, several hundred megabytes.
- Player. A slightly smaller download but still large.
- Server Installation Guide 
- Appliance Installation Guide. 
I recommend dropping these on the Ubuntu desktop.
Server has to be installed from a command prompt because it has to be installed with root priviledges.Â Open a terminal window and do the following.
$ cd ~/Desktop
$ tar -xzfÂ VMware-server-2.0.0-122956.i386.tar.gz
This leaves a directory named vmware-server-distrib on your desktop.Â Execute the following:
$ cd ~/Desktop/vmware-server-distrib
$ sudo ./vmware-install.pl
This starts the install.Â You will be asked a series of questions.Â The default answer works for each question – just hit <enter>.Â When it asks about networking, choose both “bridged” and “NAT”.
When the install finishes, you can delete the above installation files.
The server is controlled through a web interface.Â To connect to the server, go to your web browser and type the following:
http://localhost:8222 (sorry ’bout that)
Port 8222 assumes you chose the default option during the install.
Open the installation manual and go to the chapter on installing a virtual machine on Linux.Â Follow those step-by-step instructions to create a virtual machine appliance.
At some point you’ll be asked to put your windows distribution disk in a CD drive.Â This must be a bootable CD drive because the windows distribution disk will be booted into the virtual machine and the installation commenced.
When the procedure asks for a virtual drive size, choose a large one, say, 20 gigabytes.Â This does not occupy 20 gigabytes on your hard drive.Â That simply sets the largest size permissible in this VM.Â The size can be changed later but it’s a pain, involving a partition manager and stuff.Â The virtual drive file grows as data is placed in it.Â It can also be shrunk using the VMware tools.
After the windows install is finished, launch the virtual machine by “turning it on”.Â Windows will boot in a new window and do all the preliminary stuff that a new install does.Â Choose the option from the web interface to install the VMware tools.Â These tools are vital and must be installed from the web interface.Â Once all of that is done, shut down the windows VM (just like you would a regular windows machine) and exit the browser interface.Â We are now finished with Server.
Server will let you run a VM but it will not allow you to access most of your machine’s hardware resources.Â Therefore after we used Server to build the virtual machine, we will install and use Player to actually run it.Â Player allows almost no changes to be made to the virtual machine but it does enable all the resources.
To install player, assuming that the terminal is still open and that the player file is on the desktop, do the following:
$ cd ~/Desktop
$ sudo ./VMware-Player-2.5.1-126130.i386.bundle
Let this installation run its course.Â In the process it de-installs Server. When it finishes, a command called “vmplayer is installed in /usr/bin.Â This is the player.
The windows VM is installed in
/var/lib/vmware/Virtual Machines/<windows VM name>
I called my windows VM “winders” so my machine is located in
The actual machine is
The virtual machine was installed by server owned by root.Â The machine has to be owned by your account for Player to run it so do the following, substituting your userid and VM name.
$ cd “/var/lib/vmware/Virtual Machines/winders”
$ sudo chown jgd *
Substitute your userid for “jgd” and your VM name for “winders”.Â Be sure to use the quotes as indicated because of the space in the directory name.
To start a windows session I would type
$ vmplayer “/var/lib/vmware/Virtual Machines/winders/winders.vmx”
The quote is necessary because of the space in the Virtual Machines directory name.Â Now this is a lot of typing so what I did was create a desktop icon containing the above command.Â To do that, right-click somewhere on your Gnome desktop and select “create new launcher”.Â Give it a name and put the above command (substituting your VM name, of course) in the “command” slot.Â Close the window and a new icon will appear on your desktop.Â That’s all there is to it.
You’ve now finished installing the VM.Â You can launch windows by double clicking on the icon you just created.Â There are a few things that you need to know that the manual doesn’t explain.
Any resource allocated to the VM (by enabling it using the lower right icons or the menu at the top left) is not available to the Linux system. Thus, if you allocate your printer to the VM, you cannot print in Ubuntu until you either un-allocate the printer or shut down the VM.Â As shown in the second screen capture above, I leave everything unallocated until I need it.
When you allocate a resource for the first time, windows discovers it as new hardware and runs the plug’nplay for that device.Â If the device needs a supplied driver on disk (my scanner and laser printer, for example), have the disk ready and placed in the CD drive.Â The CD drive must be allocated, of course.
When you are ready to de-allocate a disk drive you must first safely remove it from windows using the icon on the tray.Â This is just like on a windows machine.Â If you don’t “safely remove” the drive, when you un-allocate it, it will be left “dirty” and will not mount on your Linux system until you use windows to fdisk it.Â As far as windows knows, it is running natively on actual hardware so you have to do everything just like you did when windows was installed on your machine.
Closing the windows window puts windows into hibernate mode.Â When you click the desktop icon again, windows resumes where it left off.Â This is a good thing except that you must not shut down Linux with windows hibernating.Â If you do, windows will start in an unknown state and will probably BSOD.
When windows BSODs (it does that as a virtual machine just like it does on a real one), do not just close the blue screen window.Â That will hibernate the BSOD.Â When you restart windows using the icon, it will go through the process of starting up, only to BSOD again.Â Instead of closing the window, use the Player dropdown menu at the upper left to “shutdown and exit”.Â This is like flipping the power switch on a real machine and allows windows to start from scratch on the next startup.
That’s about it.Â You can now install your windows applications just as you would on a real machine.Â The VM runs windows about 2/3 normal speed as compared to native windows.Â That’s acceptable to me.Â Especially since I don’t run windows all that much.Â I try to do everything I can in Linux native mode, saving the windows VM for only those apps that won’t run under Wine and for which I’ve found no Linux substitution.