Wednesday, June 1, 2011

Virtualisation Environment

Task / Aim

Virtualisation environment (e.g., xen, kqemu or lguest) to test an applications, new kernels and isolate applications. It could also be used to expose students to other alternate OSs like *BSD

Procedure


What is Virtualisation?

Virtualisation, in computing, is the creation of a virtual (rather than actual) version of something, such as a hardware platform, operating system, a storage device or network resources.

So what we are going to do is to install another operating system say 'Ubuntu' within our host operating system 'Fedora'. Now the 'Ubuntu' contained within the virtual machine is called as the guest Operating System. The software that we are going to use to perform this is the open source software called 'Qemu'


Installing Ubuntu within Fedora using QEMU



  1. The first step involved here is to download the QEMU source code (if it is not already present). You can perform this download by clicking the following link Download QEMU Source code
  2. Next task is to build the emulator from the source code. Go the folder where you have downloaded the source code in the terminal and enter the following two commands:

    • $ tar -zxvf qemu-0.14.0.tar.gz
    • $ cd qemu-0.14.0

  3. Next we are going to configure the qemu script such that it is built for i386 architecture. However it supports various other architectures like ARM, PPC, SPARC etc. Enter the following command:

    • $ ./configure --target-list=i386-softmmu

    (Before doing this make sure you have installed Header files and libraries for zlib development. If you haven't then go to 'Add/Remove software' app in Fedora and do it and then configure your script)
  4. Once you are done with configuring now you have to install it. For doing so, you must login as root in your terminal using the 'su' command. After that use the 'make' command to install it.

    • $ su
    • Password: (This is not a command, but will come when you enter su)
    • # make install

  5. Now you have installed qemu. Next step is to create the virtual machine. The first step in that is to create a Virtual Hard disk image for that. For our Ubuntu OS let us a create an Hard disk of size 10 GB. To create that go to a folder where you want to create the hard disk image and enter the following:

    • $ qemu-img create ubuntu.img 10G
    • $ ls -lh ubuntu.img (To check)

  6. So you have created the hard disk. What next??? Yes..To install Ubuntu into it. You have to download ubuntu and place its .iso image in the current working directory.
    Then execute the following commands

    • qemu -hda ubuntu.img --boot d -cdrom ./ubuntu-10.10-desktop-i386.iso -m 512

    In the above command, '-hda' option specifies the disk image file, '-cdrom' is the CD-ROM or iso image to be used and '-m' option specifies the memory to be allocated for the guest OS. In this case it is 512 MB of RAM.

    Now our Virtual machine is ready. Just got to install ubuntu in it. The screenshot is given below:

** Here we have build the software from the source. If you find it complicated you can always use fedora's "yum".... Just install using the command 'yum install qemu' and after that see 5th and 6th points given here.

*** This may be revised in future. Stay tuned for updates. If you find any problem or have any suggestions for improvements, you can always mail me.

By G.Vivek Venkatesh