Monday, 16 July 2007

Running Windows XP under Ubuntu with VirtualBox

A few weeks ago I installed another virtualization product under linux. It's name is VirtualBox
I have been using VmWare but I decided to use an open source virtualization tool. So I found VirtualBox that is freely available under GNU General Public License (GPL).

According to its site :
VirtualBox runs on Windows, Linux and Macintosh hosts and supports a large number of guest operating systems including but not limited to Windows (NT 4.0, 2000, XP, Server 2003, Vista), DOS/Windows 3.x, Linux (2.4 and 2.6), and OpenBSD.

After reading the site I understand that there are two versions, one open source with GPL license and one in binary format with an installer and a PUEL license

First I downloaded the file
virtualbox_1.4.0-21864_Ubuntu_feisty_i386.deb
from the site :
http://www.virtualbox.org/wiki/Downloads

After the download was complete I ran the command :
sudo dpkg -i virtualbox_1.4.0-21864_Ubuntu_feisty_i386.deb

Then it appeared in the menu Applications->Systems :
InnoTek VirtualBox

Afterwards I allowed my user to run virtualbox.
I went to the menu System->Administration->Users and Groups
Clicked on "Manage Groups" and added my user to the group "vboxusers"

I rebooted and afterward I launched the VirtualBox application and pressed the New Button and followed the wizard.
I created a 5 gb disk and a virtual PC with 256MB ram.
I enabled the cdrom drive and inserted the Windows XP that came with the laptop in the cd-rom drive.
Before starting the virtual machine I changed the "Host key" because the default is the right ctrl, but my laptop doesn't have a right-ctrl.
So I selected the menu File->Global Settings and then in the Input option I changed it for the left ctrl (Control_L).
Afterward I started the virtual machine and the Windows XP installer appeared.


If I moved the mouse over the virtual machine window it captured your mouse, to get out I pressed the "host key".

Windows XP was installed with only 800x600x32 bits screen resolution. To have a better resolution I installed the guest add-on (In the running virtual machine window I selected devices->Install Guest Additions).
After that in my case I was able to select 1400x1050x32bits.
And then when I moved my mouse over the virtual box window it captured the mouse, but if I moved the mouse away it freed the control (without need to press the "host key").

I was able to surf the web inside XP, but I want to share a folder between both operating systems so I opened a terminal in ubuntu and ran the command :

VBoxManage sharedfolder add Virtual_Machine -name "sharedfolder" -hostpath "/foldertoshare"

Virtual_Machine : is the name of the virtual machine. Mine is "Windows XP".
sharedfolder : is the name of the resource to be used in the "net use" command under Windows.
foldertoshare : is the name of the folder in ubuntu that you want to share.

Here is the command I used :

ubuntu@horus:~$ VBoxManage sharedfolder add "Windows XP" -name discoD -hostpath /diskD/

I exited the terminal started the virtual machine and after I was logged in windows XP I ran :
net use Z: \\vboxsvr\discoD
Then I was able to share data with my ubuntu.
Here a Picture with the net use command :



2 comments:

Happy Linux Guy said...

I just want to mention that when I tried to install guest addins, it initially didn't do anything.


I had to go to mount cdrom image. In the list, it displayed vboxguestadditions.iso. Once I mounted that, I was able to browse to the image and run the install.

Ashwin said...

Hi,
The "install guest additions" is not responding even after mounting the "VBoxGuestAdditions.iso". And also I got an Error 53 in windows command promt when I tried the share folder procedure. Can I use Devices->Shared folders for this purpose instead? Have specified the path but not able to find out where this folder is available in windows.