Saturday, December 25, 2010

Virtual Box; Windows XP inside Ubuntu

I use MS Windows at work so I still need a MS Windows machine here at home too. I was going to make my home PC a duel booter but I did not have my MS Windows Install CD when I installed Ubuntu (it is very easy to make a duel boot Ubuntu/MS Windows machine if you have MS Windows installed before you install Ubuntu. If Ubuntu is installed first it get complicated and you can trash your system). Well last week I found my MS Windows XP Pro (Full Install Disc. Yes I paid the $299 or $399 to add XP Pro to a custom build PC once) So I decided to try to make a Virtual Machine.


After a little reading I decided to try out Virtual Box. Let me cut to the chase, it works great. You get Ubuntu and MS Windows XP on the same machine running at the same time and you can switch between them by simply minimizing a program (copy and paste work too).

There are two version of Virtual Box for Ubuntu, one you install from the UBUNTU SOFTWARE CENTER and the other you download as a .deb file. The difference as I see it has to do with OPEN SOURCE / CLOSE SOURCE debate, both version are free of charge. To me the difference that mattered was the fact that the Close Source supports USB and the Open Source didn't.

If you are one of those people that has to have Open Source Software no matter what, follow the red instructions: PART I - Installing VirtualBox OSE.

If you need USB to work
skip the red section and go to the green: PART I - Installing VirtualBox PUEL



PART I - Installing VirtualBox OSE
How to Install the Open Source Version (NO USB SUPPORT):
1. Click on APPLICATIONS Menu

2. Click on UBUNTU SOFT
WARE CENTER

3. In UBUNTU SOFTWARE CENTER do a search for "virtualbox"


4. This will return a result which
contains VIRTUALBOX OSE

5. SELECT "virtualbox ose" and INSTALL it by click on the INSTALL BUTTON.


Done!!! You now have VirtualBox OSE installed and it will show up under APPLICATIONS--->SYSTEM TOOLS on Ubunut 10.10.

YOU DO NOT HAVE USB SUPPORT FOR THE MS WINDOW
S GUEST OS INSTALL THAT WE WILL CREATE IN PART III.



PART I - Installing VirtualBox PUEL
How to Install VIRTUALBOX with USB Support:

1. Goto the this web page and select the package for your version of Ubuntu (I used the 10.10) It should be noted that the i386 package is for 32 bit Ubuntu and the amd64 package is for Ubunut 64 bit (both 64 bit AMD and 64 bit INTEL processors. It's a bad name) FYI: this version of VirtualBox is called VirtualBox Personal Use and Evaluation License (PUEL).

2. Once you've downloaded the right package (a .deb file) install it by simply double clicking on it. This will start your UBUNTU SOFTWARE CENTER where you just click on the INSTALL BUTTON.

3. After your install completes, goto APPLICATION--->UBUNTU SOFTWARE CENTER

4. Click on EDIT--->SOFTWARE SOURCES

5. Click on the OTHER SOFTWARE tab.


6. Click on the ADD button. (this will pop up a box you can enter text into)


7. Paste one of the following lines into this pop up (ONLY USE ONE OF THESE LINES BASED ON WHICH VERSION OF UBUNTU YOU HAVE i used the 1st one, i have 10.10)

deb http://download.virtualbox.org/virtualbox/debian maverick contrib
deb http://download.virtualbox.org/virtualbox/debian lucid contrib
deb http://download.virtualbox.org/virtualbox/debian karmic contrib
deb http://download.virtualbox.org/virtualbox/debian jaunty contrib
deb http://download.virtualbox.org/virtualbox/debian intrepid contrib
deb http://download.virtualbox.org/virtualbox/debian hardy contrib
deb http://download.virtualbox.org/virtualbox/debian squeeze contrib
deb http://download.virtualbox.org/virtualbox/debian lenny contrib
deb http://download.virtualbox.org/virtualbox/debian etch contrib

8. Open a TERMINAL Window (APPLICATIONS--->ACCESSORIES--->TERMINAL) and type the following, on one line, and hit enter:

wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -

9. Once that is done, typ
e the following in TERMINAL:

sudo apt-get update (HIT ENTER KEY)
sudo apt-get install virtualbox-4.0 (HIT ENTER KEY)

10. Once that is done, type the following in TERMINAL and hit ENTER:

sudo apt-get install dkms


You should be done installing VirtualBox PUEL and you can now run it by clicking on it in APPLICATION--->SYSTEM TOOLS--->Oracle VM VirtualBox.

I know that was harder but you will now be able to run MS Windows applications and get USB devices working too.

Here is a Trouble Sho
oting Guide




PART II - Making a Virtual Machine for you MS Windows to live on.


In Part II we will make a Virtual Machine or VM for your MS Windows Guest OS to live on. We start this by launching VirtualBox (APPLICATION---> SYSTEM TOOLS---> ORACLE VM VirtualBox)

Some things to note before you start:

First, when you create your Virtual Machine it will really just be one very big file stored on you Ubuntu box. I have two hard drives on my system, one is formated in the Linux format ext3. My second drive is format in FAT32. I wanted my Virtual Machine to have 40gb of hard drive space. FAT32 will NOT allow file sizes over 4gb so I had to use my Linux ext3 drive (which was smaller) for my Virtual Machine.

Second, when you create your Virtual Machine you will have to assign it RAM too. I have 3 gb of RAM and I wanted my Virtual Machine to have 1 GB of RAM. So when I start my Virtual Machine it gets 1gb of RAM dedicated to it leaving 2 gb for Ubuntu. If you only have 1gb or worse 512 mb of RAM to start with, you should make a duel boot machine and not do Virtual, it'll be too slow. You can have multiply Virtual Machines running at the same time too but each has to have RAM dedicated to it, so if I wanted to run XP and Windows 7 on my Ubuntu box I would have to give Xp 1 gb of RAM, Windows 7 one gb of RAM, leaving 1 gb of Ram for my Ubuntu, if I had all three running at the same time. Some guides, MS Windows XP runs fine with 512 mb but 1 gb is better, Windows 7 and Vista need a 1 gb but work better with the full 1.5 gb. In Short if you have less than 2 gb of RAM on your system, duel boot don't virtual.

Third you must have a full install disc of whatever OS you want to virtulize. I did MS Windows XP Pro.

On with the show! Let's create a VM (virtual machine).

1. Start VirtualBox

2. Click on the NEW button (This starts a Wizard)

3. Click NEXT

4. Type in a NAME for your Virtual Machine in the NAME box (I used MYGUESTXP)

5. Pick the OPERATING SYSTEM and VERSION of the OS you are installing (I picked MICROSOFT WINDOWS and XP) and click NEXT

6. Use the SLIDER to pick how much memory to give you VM (I pick 1024 mb) Click NEXT

7. Select how much hard drive space to give your new VM (I checked BOOT HARD DRIVE and
CREATE NEW HARD DISK default size 20,480mb) Click NEXT

8. Read the Screen and Click NEXT.

9. Select a DYNAMIC or STATIC Hard Drive. (Dynamic will grow if needed, Fixed will not and you could "fill up" your virtual drive) (I picked Dynamic) Click NEXT

10. You can change how big to make your VM hard drive (I changed mine from 20480 mb to 40000 mb but left the name as the default) Click NEXT

11. This screen will summarize your Hard Drive choices. Confirm them and click FINISH

12. This screen summarizes your entire Virtual Machine Setting Choices. Confirm them and click FINISH.

YEAH!!! You just created a Virtual Machine or VM.

It has a CPU, Memory, Video, Networking, Sound, Serial Ports and USB Ports (if you installed the PUEL version of VirtualBox). What you do not have yet is a GUEST OPERATING SYSTEM. Read Part III for that :-)

Before you get to Part III, select your new VM by single click on it's name inside VirtualBox. Then Click on the SETTINGS Button . You can look around in the various section and change anything you think you might need too on your VM. I found that the only thing I needed to change was under the VIDEO section. I used the SLIDER to give my VM 32mb of video ram so that I could run a 1024 x 768 display with 32 bit color on my VM.




PART III - Installing a Guest Operating System on your new VM.

A computer is good to no one without and Operating System installed on it, even a virtual computer. Let's put an OS on our new VM.

1. Select your VM by single clicking on it in VirtualBox.

2. Click the START button.

3. A wizard will start, read it and click NEXT.

4. Pick the CD/DVD/HARD DRIVE your FULL MS Windows Install disc is located in. (mine was my DVD drive) Click NEXT.

5. A summary window will appear. Read it and Click FINISH.

6. This will start a standard install of whatever guest OS you are installing (mine was MS Windows XP Pro)

7. Complete the standard install of your Guest OS just like you were installing it on a real PC.

You are now done!!!.

You have created a Virtual Machine that runs a Guest Operating System inside Ubuntu.

What to do now? Install whatever software you want to run inside your VM. You install stuff just like you would if your computer was real. Do your updates, active your OS, whatever you would normally do. I've installed XP Pro, Installed Service Pack 3 on it, did all the Security Updates, Installed MS Office 2007, Photoshop CS 2, Hooked up an HP Printer/Scanner, plugged in and used several USB Thumb Drives and Hard Drives and Installed a few freeware apps I use. What I couldn't get working was my Garmin Forerunner Watch (see last post).





SOME CLOSING HINTS


Under DEVICES-->INSTALL GUEST ADDONS will make your VM act like a program running on your Ubuntu box (copy and Paste from it, mouse/keyboard trapping by click not Right-CTRL)

Your Virtual Machine will think your Ubuntu Host is another computer on the same network as it, so you can do network neighborhood sharing with it if you have SMB Sharing on your Ubuntu.

Under SETTINGS in VirtualBox you have to active USB Support and ADD a FILTER for each USB device you connect. The top Right Icon in the below screen shot ADDS a new "catch all" filter. Sometime when using USB Ubuntu will get confused as it will try mount the device too. Beware of data lose.