Wednesday, February 18, 2009

How to Create Virtual Machines in Ubuntu

Virtual machines allows you to run multiple operating systems on a particular operating system. For instance, you're currently running Linux and within linux, virtual machines enable you to install & run Windows (!) therefore windows all your Windows applications.

According to freesoftwaremagazine.com, there are four (big ones) virtualization tools to use: Parallels, VMWare, QEMU, and VirtualBox. Parallel is not free, so you have to pay for it. VMWare has free versions, i've tried it but didn't work for me, and besides, the download took around 580MB. From what i read QEMU is command-line, so it's very complicated to create a new virtual machine (although there are GUIs made for it). The last option, and i believe the best option we have, is VirtualBox.

There are two available version of VirtualBox: the free Open Source Edition, and the Personal Use and Evaluation license.

The easiest to install, coz it's the one i've tried is the Personal Use and Evaluation license.



Download the Installer

Head over to
http://www.virtualbox.org/wiki/Linux_Downloads

to download the installer for your version of Ubuntu. i've downloaded the virtualbox-2.1_2.1.4-42893_Ubuntu_hardy_i386.deb, and it's only 36.2MB! Compare that to the 580MB download for the VMWare server.


Install the Required Packages

We also need to install some packages before we can install virtualbox.

in the terminal do this
apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential
in case you don't know where the terminal is, go here.


Install VirtualBox

Go to the directory where you've downloaded the virtualbox installer. Double-click it, and the package installer should say all dependencies have been satisfied. If not, the installer will automatically install the required packages.

Click on Install Package.

if incase the shortcut to VirtualBox cannot be found under
Applications>System Tools>Sun xVM VirtualBox
in the terminal do this
sudo /etc/init.d/vboxdrv setup

Just answer yes to all of the questions asked :D

after that, you should find the Sun xVM VirtualBox short cut link. click it and you're ready to go.

If VirtualBox shortcut link is no where yet to find, press Alt+F2, and type VirtualBox (take note of the capitalization). That should bring about the link, and should also start VirtualBox.


Creating a Virtual Machine

On the VirtualBox window click on New and the following window will appear, welcoming you to Create a New Virtual Machine Wizard. simply click on Next.

Specify the Virtual Machine name and operating system type. For example, you are to install Windows XP, choose the following settings.Next, we specify how much memory will be alloted to your virtual machine. Assign 192MB for now, anyway, you can always change that later.
Next, we'll be creating a virtual hard disk. If there is already an existing virtual harddisk, click on Existing, otherwise click on New..
Simply click Next.
You are now to select the Hard Disk Storage Type. I chose a dynamically expanding storage to save disk space on my "real harddisk"
Specify the disk location and size. Since i'm just installing Windows XP, 1GB is enough for now. But remember, since i specified dynamically expanding storage, that size will expand later, if the OS needs more hard disk space.
The summary will be shown to you. Click Finish. You will now proceed with the remaining process of the creation of virtual machine.
The Summary of you virtual machine settings will be shown to you. Click on Finish.

Finally, you are now ready to run your new virtual machine. Click on Start and it will prompt you to insert the CD for your new operating system. The installation of Windows XP should now begin.

I won't be covering the installation process here..it's up to you to experiment. anyway, if you make a mess of things, you can simply delete the virtual machine by selecting it and clicking Discard.

If you found this simple tutorial useful, please subscribe or leave a message. :)

15 comments:

  1. thanks... it is really simple and useful

    ReplyDelete
  2. it does not support the usb port and I am searching for solution do you have any idea how to do it?

    ReplyDelete
  3. I've Mint 6 in use en downloaded VBox 3 deb. And I tried it.
    All is rather okay, but sound had gaps. (PCLOS)
    The resolution of the display was not right with Ubuntu remastersys-livecd.
    I think VirtualBox is not ready yet?!
    But a beautiful idea. I love it when it is ready.

    rijnsma

    ReplyDelete
  4. Very well explained. I've followed it and works fine.
    Many thanks

    ReplyDelete
  5. that was useful to me, thanks a lot :)

    ReplyDelete
  6. Great job! Thank you

    ReplyDelete
  7. Good job.

    However you need to change your wording just a little bit. You stated :
    "1GB is enough for now. But remember, since i specified dynamically expanding storage, that size will expand later, if the OS needs more hard disk space".
    It is actually that the maximum space it can grow to is 1GB so the size will not grow beyond 1GB.

    It might be worth mentioning that the Personal/Eval version supports USB without hassle but the OSE version does not.
    -----------------------------------------------
    The box said XP or better so I installed Linux!

    ReplyDelete
  8. Very nice way to redact a post! I think we need more blogger like you with this informational sense to being an explicative blogger. In the other hand, we can't ignore how important was this blog to learn about those applications because it spported host operating systems include Linux, Mac OS X, Windows XP, Windows Vista, Windows 7, Solaris, and OpenSolaris. 23jj

    ReplyDelete
  9. Excellent post.I want to thank you for this informative read, I really appreciate sharing this great post. Keep up your work.
    I think, that you are not right. I suggest it to discuss. Write to me in PM, we will communicate.

    ReplyDelete
  10. excelent blog and nice to read. I really liked your blog and would like to know more about the topic. Thank you for the post.

    ReplyDelete
  11. Hello .. I have never seen a smart articles that you created. It really helped me to get back my ideas for writing. I will save this post, for I learn more.

    ReplyDelete
  12. Great post dude.. Wow, some ppl need to grow up and get a life.. U know what's great about the internet, u can go where you want and read what u like. If you don't like something then simply leave. seriously, why talk crap about someone who is simply trying to help others with something they don't know about? Grow up, u don't like this guys post's, u think he's stupid, fine that's ur opinion.. Do us a favor and keep it to yourself, use the navigation on ur web browser to leave and refrain from coming back. U obviously think u know what ur doing so go... Do it.. Leave this guy alone.. At least he can spell and his grammer is understandable. That's more than I can say for the lot of posters and commenters.. I swear, half the time I can't even understand 75% of an article and most of the time I can't understand comments at all. If ur find speak and write a language then u should probably learn how to first, it's really not that difficult.. And it's sad that most of the ppl who totally massacre sentences and paragraphs are actually American.. How do you not know how to correctly write in a language that is A. Ur first language and B. One u get taught from the time u spoke ur first word? Writing is simple, u write how u would speak. It really isn't that difficult... Not trying to diss anybody here, just believe I'm speaking for all when I say WE DON'T UNDERSTAND GIBBERISH, so have common curtesy and write correctly so that we may understand what it is you are trying to communicate to us.. Thank you.

    ReplyDelete