Virtualization Technology (or how my Windows computer gave birth to a bunch of Linux computers) The purpose of this document is to walk you through creating a Linux Virtual Machine (a guest Operating System) running inside your Windows System (the host Operating System). Note that this is not the only possible combination of guest/host Operating Systems. One can create a Windows Virtual Machine inside a Linux System or a Windows Virtual Machine inside a Windows System, etc. In particular we will discuss using VirtualBox, an open source product, to create guest OS instances in a host OS. What makes this possible is a technology called Virtualization, which was invented by IBM for mainframe about 25 years ago. Recently, Virtualization on Intel chips became popular in the computer industry. The main players are VMware and Xen Source, the latter is an open source product. KVM and VirtualBox are the other players. Virtualization is like car pooling for computers: instead of one Operating System (OS) image running on one physical machine, multiple OS instances run on the same physical host at the same time sharing the physical resources of the single machine. The OS instances do not have to be of the same type. One can have a mixture of OS images running at the same time on a single machine. What makes this possible is a sophisticated piece of software called hypervisor. One can picture a hypervisor as an Operating System of Operating Systems: just like an Operating System scheduling the various processes running on it onto physical processor(s), a hypervisor schedules the Operating Systems onto physical processor(s). This document does not discuss an enterprise style deployment of virtualization in the sense that hypervisor is first installed on top of bare metal, and then, one creates virtual machines. Rather, we discuss how we can create one or more Virtual Machines inside a host OS. In particular we will choose a Windows host system and will walk through creating a Linux guest System to run inside the Windows host system. The Linux distribution we will use is Ubuntu. (It should be emphasized that one can choose any other Linux distribution to install as a guest OS.) What you need to download? Download VirtualBox software from the following location: http://virtualbox.org/wiki/downloads You will need x86 version if you are running a 32-bit Windows OS, which must be the most likely case. If not, then you will need the AMD64 version. The size of the download is about 20 MB. Also, download the User Manual. It has a lot more detail than the discussion in this document. Download Ubuntu version 7.10 from the following location: http://www.ubuntu.com/getubuntu/download This one is a large download, about 700 MB.
Major Steps You will first install the VirtualBox software. Just click on the executable you downloaded from VirtualBox site and follow the instructions. Not much to talk about here. Start the VirtualBox tool. It has a simple UI that allows you to create virtual machines. We will walk through this step at length below. Install the so-called guest additions for additional improvements to your virtual machine like better screen resolution. We will discuss this step below as well. Creating an Ubuntu Linux Virtual Machine to run inside Windows XP Download VirtualBox and the iso image of Ubuntu 7.10. Install VirtualBox. Run VirtualBox From Start -> All Applications -> Innotek VirtualBox ->VirtualBox. On the UI click the New button and you will get the wizard to create a new virtual machine as in the snapshot below. Click next.
Type a name for the new virtual machine you are creating. Also, choose an OS type. For this example the new virtual machine is named dirac and an OS type of Linux 2.6 is chosen. (2.6 is the Linux Kernel Version of Ubuntu 7.10.) Click next.
Now, you need to assign resources to your virtual machine. The first thing to assign is memory, see below. 512 MB seems like a good start. Note that virtual machine will share resources with your host OS. If you do not have much memory in your system, your host and guest OSs could slow down significantly.
Next, you will define a virtual disk for your guest, which won t access your entire hard drive, but a part of your hard drive will be virtualized to seem like a full disk to your virtual machine. See the figure below. Click New to create a virtual disk for your new virtual machine.
You will be presented with virtual disk creation wizard. Click Next to continue. See below.
Choose Dynamically expanding image as in below.
Name your image file name, which will be the file that will contain the virtual disk. Also, choose the size of disk. 4 GB could be sufficient for a small system. We choose 8 GB for this example and name the disk file dirac as well.
View the summary as in below and click Finish.
Now that virtual disk is available, choose it for your guest system and click Next.
View the summary of the properties of your virtual machine and click Finish and you have a virtual machine created. (If you need to make changes, you can go back by clicking the Back button.)
Next step is to boot your virtual machine from an OS installation disk. Choose Properties, then CD/DVD-ROM, check Mount CD/DVD Drive, and choose ISO Image File. Locate the Ubuntu iso image in your computer. This is where the virtual machine will boot from. Click OK. (Note that at this stage you can choose any Linux distribution you want.)
Now, start your virtual machine by clicking Start on VirtualBox UI. You will be presented with the following screen if you are using Ubuntu iso image file. Just press the return key and Ubuntu will boot from the iso image. Note that at this time we are not installing Linux, just booting Linux from iso file.
If everything works smoothly, you should have your virtual machine booted from iso file as in the picture below. At this time you are running a Linux machine inside Windows. Note that Windows sees the virtual machine just like any other process, but to a user like you the virtual machine is no different than a real machine. Important: in order to be able to navigate inside the virtual machine, you will need to first click anywhere inside it to get your keys/mouse actions captured by the virtual machine. To get out of the virtual machine you will click the right control key and move the cursor out. Moving cursor smoothly from host to guest and back will be possible once we install guest additions later.
Next, we will install Ubuntu on the virtual disk and boot from the virtual disk. Click on the Install icon in the Linux Virtual Machine UI. See the picture above. Next, you will be presented with a set of install defaults. Just choose whatever your need is and click return. Important: due to screen resolution at this stage, install screens bottom portion was not accessible in my run. If you just click return, install proceeds. We will fix the resolution problem later.
See the step below. Note how install sees the virtual disk you created as the real disk.
Once you go through all defaults, the install will proceed. See below.
See the directory listing below. The virtual disk is created as a file under C:\Documents and Settings\Administrator\.VirtualBox\VDI. (This is just for your information.)
Once install is done, you will need to restart your virtual machine, so that it boots from the virtual disk. Just click Restart Now. See below.
GUEST ADDITIONS One issue is screen resolution. By default it is 800X600, which will not be enough for most users. We will need to install guest additions to increase resolution. This will also make navigation in and out of the virtual machine easier as we discussed below. First, go to Devices -> Mount CD/DVD ROM -> CD/DVD ROM Image. There, choose VBoxGuestAdditions.iso. See figure below. Then, click Select.
You will get the guest additions mounted as a CD ROM. See below. We will run the program VBoxLinuxAdditions.run in a terminal. First, we need to log in as root.
So far we have not set the password for root. Go to System -> Administration -> Users and Groups. Then, Choose root and click Properties. You will see the following screen. There, set the root password.
Now, open a terminal from Applications -> Accessories -> Terminal.
Do the following in the terminal: Change to user root as su - root. You will be prompted the root password. Then, change directory to /cdrom. Finally, run the install by typing sh./vboxlinuxadditions.run. See the picture below for all these steps.
Once the guest additions installed, you will be prompted to restart your system. Click the red Power button on the upper right hand corner of your virtual machine window. Choose Restart.
After OS reboots, go to System -> Administration -> Screen and Graphics. There, choose your model and Resolution. For instance, I have a laptop that has an LCD screen with resolution of 1400X1050 and I would like to have a resolution of 1280X1024 for my Linux guest machine. The picture below shows how I made the changes. Click OK. Then, you will be prompted to logoff. Relogin.
Once you log off and relogin, you should have the new resolution. If you go to System - > Preferences -> System Resolution, you will get the list of possible resolution settings. See below.
Now you are ready to work on your virtual Linux machine. Below is a snapshot of the one we created for this walkthrough. It is running a browser and a terminal.
STOPPING A VIRTUAL MACHINE When you want to turn off your virtual machine, you will be presented with a set of choices. If you choose Power off machine, the virtual machine will be shut down similar to unplugging a computer. Virtualization has a nice feature: you can save the state of the machine and restart the machine later to get back to that state similar to stand by in windows system. Note that you can get back to that state even if you power off your host computer. See the snapshot below.
Once you stop your virtual machine, you can see its state and properties in VirtualBox UI as in the snapshot below. Note that you can use the Discard button to delete a virtual machine. This will not remove the virtual disk, though. Virtual disks can be deleted by following the link File -> Virtual Disk Manager on VirtualBox UI. Some Links VMware is the major company in the Intel Virtualization space. Their WEB site has a lot of good reading on the technology: http://vmware.com/virtualization/ XEN source is the up-and-coming competitor to VMware. It is open source. There are some good papers on the technology here: http://xen.org/ KVM is another open source hypervisor. It is essentially Linux acting as a hypervisor. Another up-and-coming hypervisor: http://kvm.qumranet.com/kvmwiki