Sei sulla pagina 1di 3

Virtual Machines

Virtualizing Windows with Virtualbox


Clment Lefebvre

hat if you could run Windows and Linux at the same time? What if you could run them, not only at the same time, but on the same computer? What if you could run your Windows and Linux applications on the same desktop, without switching between Linux and Windows? Well... you can! Virtualization allows you to create virtual machines (i.e. Virtual computers which you can run independently within their own window). Its origins go back to the early 60s but it became popular among desktop users in 1999 when a company called VMWare introduced the first x86 virtualization software. It was easy to use, and though the concept was new for many people it quickly became something many people used. In 2007, a company called InnoTek released Virtualbox, an easy to use virtualization solution released under the GNU General Public License. This open source alternative to VMWare became extremely popular. Nowadays, its used by Linux users to run a copy of Windows, by Windows users to give Linux a try, by distributions to test their releases and by reviewers to review them.

Thanks to virtualization you can create your own collection of virtual computers. You can give each computer its own resources, you can install separate operating systems, you can even give a particular virtual machine more than one partition and more than one operating system. In almost every way, with the exception of using real hardware, your virtual computers are de-facto behaving like real computers and as far as the software running in them is concerned, theres no tangible difference.

Installing Virtualbox and creating a virtual machine


To install Virtualbox, install the virtualboxnonfree package. The reason its called non-free is not because it costs something (it doesnt), but because although its Open Source, it includes a small proprietary component which adds USB support to your virtual machines. If youre not planning to plug-in USB devices in your virtual machines, you can install the virtualbox-ose package instead. Once installed, you can launch Virtualbox from the Menu, by clicking on System Tools and selecting Oracle VM Virtualbox (initially released by InnoTek, Virtualbox was then acquired by Sun Microsystems which now belongs to Oracle). To create your first Virtual Machine (commonly referred to as a VM), click the New button, give it a name and indicate the type of operating system youre planning on installing on it. In this article well install Windows XP, so well give it the name My Windows box, with Microsoft Windows as the type, and Windows XP as the version. XP is faster and takes less resources than recent versions of Windows and its still compatible with most applications, so its a good choice for a virtual machine. Note that if you want to install any other version of Windows, or any other operating system, the procedure is exactly the same. On the next screen youll have to decide how much memory (RAM) you want to give

Figure 1. The concept of virtualization 32

Linux Identity Office

Virtual Machines
your Windows VM. You dont want to give it too much, otherwise your main operating system (Linux Mint) wont have enough memory for itself and will start getting slow, but you also want to give it enough for your virtual machine to be able to run Windows. If you have 4GB RAM, and youre only planning to run one virtual machine, you can probably give it half, i.e. 2GB RAM. If you only have 2 GB RAM, you can probably give it 1GB RAM... and if you only have 1GB, you probably just dont have enough memory to run Linux Mint and Windows at the same time. Note: When the VM is running, its using all its assigned memory. When its not running this memory is freed. Say you have 4GB RAM and you give your VM 1GB RAM, when its running your Linux Mint system can use 3GB RAM. If you turn off the VM, then Linux Mint can use the whole 4GB RAM. On the next screen youll have to decide how much disk space you want to give your Windows VM. You can create virtual hard disks, which effectively are large files which the virtual machine sees as separate hard drives. Select Create new hard disk and click Next. Then select Dynamically expanding storage and click Next. You can then select where you want the virtual hard drive to be located (i.e. Where on your real hard drive, will the file representing this virtual hard drive be stored) and more importantly how big you want it to be. Your virtual machine will operate on its own, in its own World, in its own sandbox without much interaction with your main operating system. It wont see your real hard drive for instance. If you create, say a 10 GB virtual hard disk and give it to your VM, thats the only space available it will have. If you install Windows on it, it will see this virtual hard disk as C:\ and nothing else. Similarly, the BIOS of your virtual machine will only detect one hard drive... that virtual hard disk youre about to create. After you click Next you can then click Finish and your virtual machine is ready.

Figure 2. Virtualbox, with 4 virtual machines set up

Installing Windows in the virtual machine


Select your VM in the left pane of Virtualbox and click on storage in the right pane. Under IDE Controller, click on the Empty CD. And on the right hand side, on the right of CD/DVD Drive, leave the combo box on IDE Primary Master and click on the CD button to select your Host drive. Note: The Host refers to your main operating sys-

tem. Guests often refer to the operating system installed in the virtual machine. What we did here, was to make our VM use our real DVD drive... so that it could see our Windows CD and install from it. Next, insert your Windows installation CD in your drive and run your virtual machine by clicking on it in the left pane of Virtualbox and by pressing the Start button. Follow the instructions on the screen and install Microsoft Win-

Figure 3. Windows XP running in a virtual machine 33

www.linuxidentity.com/us/

Virtual Machines
dows the way you would normally do on a normal computer. When it comes to assigning partitions and selecting hard drives, tell Windows to use the entire disk. Dont be afraid, your virtual machine cannot see your real hard drive. What it calls and sees as the entire disk, is basically the virtual hard disk you gave it, which in your real hard drive, is nothing else than a simple file. When finished you should have a virtual machine ready with Windows installed in it. You can add software to it (iTunes for instance is something many Linux users install in their Windows VM so they can sync their iPhone, iPods or iPads) and configure it. Note: You can copy your virtual hard disk to a USB stick and carry it around with you. That way, no matter what computer youre using and which operating system its running, if it has Virtualbox installed, you can point it to it and access your virtual Windows XP installation. between a PC and Mac... but Apple doesnt support other hardware devices than the ones they provide and they also include a chip in their computers which Mac OS X checks for to make sure its running on Apple hardware. Because of these limitations, at present, you can only run Mac OS in Virtualbox within Mac OS X itself... which isnt very useful.

Activating the seamless mode


Virtualbox features one of the nicest innovations in virtualization software: the Seamless Mode. This mode uses clever tricks to make it looks like both your host and your guest operating systems (i.e. Both your real system and your virtual machine) are sharing the same desktop. In seamless mode, you dont see your Windows background and your Windows virtual machine doesnt run in a window anymore... it runs in the background. The Windows bar and menu come and position themselves on top of your Linux Mint GNOME panel, and so you have access to both, one being on top of the other. You can launch Linux applications from the Mint menu, or Windows applications from the Windows menu, and they both appear on your Mint desktop. If you move a Windows application fast enough, you can see the background redrawing itself quickly behind it. Of course, your Windows application is in fact running within Windows and within the virtual machine itself, but the seamless mode hides this from you and lets you interact with Linux and Windows applications from the comfort of the same desktop. Its elegant, extremely handy and theres nothing else like it. If you have enough space, enough RAM available and you dont mind leaving the Windows VM running in the background, this is really convenient. To active the seamless mode, select Machine and Switch to Seamless Mode. The VM will then run in the background and its bar, menu and applications will use your main desktop. Most Linux users dont run Microsoft Windows for every day use. In most cases they need it for a particular reason, and very often simply to run one particular application: AutoCAD, Photoshop, Microsoft Office (for some), Money, iTunes, etc. With a Virtualbox VM running in seamless mode they can continue to enjoy their Linux desktop while having access to the Windows applications they need.

Installing the Virtualbox guest additions


At the moment, your virtual Windows runs without 3D acceleration. Think of it as a real computer... instead of having an ATI or NVIDIA card, it has some kind of Virtualbox graphics card. This graphics card, despite the fact of being virtual, actually needs drivers to run efficiently. The same goes for other devices and components of the VM... which use Virtualbox virtual hardware. These components need drivers to be installed to work efficiently with Windows. Once these are installed you get access to additional features and you can do some really advanced things such as activating the seamless mode. To install these drivers, select Devices and click on Install Guest Additions.... Then, in your Windows VM, open My Computer and you should see a volume corresponding to the Virtualbox guest additions. Double-click it and follow on the instructions on the screen. Once finished. Reboot your virtual machine.

Doing the same with Mac OS X


Theorically it should be possible to do the same with Mac OS X. But here again, the same way Apple makes it hard for people to use iPhones without iTunes, they make it hard for people to use Mac OS X without a Mac. From a hardware point of view, there isnt any significant difference

Figure 4. Running Windows and Linux applications on the same desktop 34

Linux Identity Office

Potrebbero piacerti anche