<---- template headericclude ----->
Virtual machines with QEMU & KQEMU - Windows XP guide shown, others possible
FedoraForum.org - Fedora Support Forums and Community
Page 1 of 7 123 ... LastLast
Results 1 to 15 of 98
  1. #1
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Virtual machines with QEMU & KQEMU - Windows XP guide shown, others possible

    Hello,
    Recently I remembered how I used to be able to boot Windows XP in a window using QEMU - A virtual machine emulator. I noticed that version 8 now supports network, but sadly it didn't work out of the box when I installed Windows XP to a 10GB image file. Luckily, after a few hours of research, I found a method that works. In this guide I will guide you through the steps needed so you can do the same.

    A bit of background information first: A little thing to note before starting is that even with the KQEMU accellerator, don't expect it to be really speedy. Your guest OS will function, but at a slightly to greatly reduced speed depending on your guest OS's settings - For example in my installation of Windows XP I've disabled most visual themes, and run it at a 800x600 resolution and it runs pretty well. If I enable themes or run it at a 1024x768 resolution, I notice a quite large speed decrease.

    Now, for guest and host OS. The guest OS is the OS you're going to run via QEMU; The host is the one naitively running QEMU. In other words, your host OS is Linux and your guest is whatever you're installing.

    Next, images. QEMU will run your guest OS off a image - It simply appears as a regular file, but QEMU will fake it to be the guest system's hard drive space. So the bigger your image, the more space you'll have in your guest OS.

    (1): Install QEMU, the KQEMU accellerator and bridge-utils

    QEMU will be needed to emulate the machine, and KQEMU is a kernel module that GREATLY accellerates QEMU when executing naitive architectures. In other words, if you're running a i386 system and emulating a i386 system, the KQEMU module will make the speed of emulation near the same! bridge-utils is for networking. First, let's get QEMU installed:
    Code:
    su -
    yum install qemu bridge-utils
    Unfortunately, the kernel module for KQEMU has only been build for the i386 architecture. Sorry if you're not i386 - You could compile it manually if you wanted, but RPM packaged install is only for i386 machines.
    Anyways, browse to:
    http://fedoranews.org/tchung/qemu/0.8.1/fc5/
    this web folder and download the appropriate kernel module to your home.
    ****************************
    Make sure you download the correct one for your kernel - the
    kmod-kqemu-0.7.2-6.fc5.2.6.16_1.2111_FC5.i386.rpm
    module will not work on the 2.6.16_1.2007_FC5 kernel. To check your kernel version, type:
    Code:
    uname -r
    .

    If the module for your kernel doesn't exist, then please type:
    Code:
    su -
    yum update kernel

    and then reboot to get a supported kernel.
    ****************************


    (2): Creating the image for the guest OS

    For best performance, you should install your guest OS to a image file. To create one, type:
    Code:
    qemu-img create filename size[ M | G ]
    where filename is going to be the name of your image, and size is the size of your image with the suffix 'M' (MB) or 'G' (GB) right after the number, no spaces. So, for example, if I typed:
    Code:
    qemu-img create WindowsXP.img 10G
    It would create a image file called 'WindowsXP.img' with size 10GB. There is no real recommended size for an image, it depends on the OS you're going to install into it, but I like 10GB as it's not too big, but provides nice room for growth in the guest OS. Remember, too the basic installs of Windows XP take about 2GB and Fedora about 1 to 2 GB.

    (3): Configuring network for your guest OS

    The next step is configuring network for the guest OS. It's a fairly simple process. Let's start by putting the following contents into /etc/qemu-ifup:
    Code:
    #!/bin/sh
    #
    # script to bring up the tun device in QEMU in bridged mode
    #
    # This script bridges eth0 and tap0. First take eth0 down, then bring it up with IP 0.0.0.0
    #
    /sbin/ifdown eth0
    /sbin/ifconfig eth0 0.0.0.0 up
    #
    # Bring up tap0 with IP 0.0.0.0, create bridge br0 and add interfaces eth0 and tap0
    #
    /sbin/ifconfig tap0 0.0.0.0 promisc up
    /usr/sbin/brctl addbr br0
    /usr/sbin/brctl addif br0 eth0
    /usr/sbin/brctl addif br0 tap0
    #
    # As we have only a single bridge and loops are not possible, turn spanning tree protocol off
    #
    /usr/sbin/brctl stp br0 off
    #
    # Bring up the bridge with IP 192.168.1.2 and add the default route
    #
    /sbin/ifconfig br0 192.168.1.2 up
    /sbin/route add default gw 192.168.1.1
    #stop firewalls
    /sbin/service firestarter stop
    /sbin/service iptables stop
    The bold values can be changed, and nothing else. Please change the IP's to show your setup - The first bold is a comment, so it doesn't really matter. The second bolded value is the IP identical to the one assigned to your computer (means you'll need static IPs so you can predict your IP) and the third and last is your gateway.

    Now, put this into /etc/qemu-ifdown:
    Code:
    #!/bin/sh
    #
    # Script to bring down and delete bridge br0 when QEMU exits
    #
    # Bring down eth0 and br0
    #
    /sbin/ifdown eth0
    /sbin/ifdown br0
    /sbin/ifconfig br0 down
    #
    # Delete the bridge
    #
    /usr/sbin/brctl delbr br0
    #
    # bring up eth0 in "normal" mode
    #
    /sbin/ifup eth0
    #start firewalls again
    /sbin/service firestarter start
    /sbin/service iptables start
    Currently, I'm not sure why, but a firewall can't be activated while running QEMU or the internet will stop working. At least, with Firestarter it does. I'm not sure about iptables. Just incase, I disabled it in the scripts. I think it's because we switch from "eth0" device to the bridged "br0", but anyways... Let's make the scripts executable so QEMU can use them:
    Code:
    su -
    chmod +x /etc/qemu-if*
    exit
    (4): Installing the guest OS

    Now, it's time to install the guest OS. Pop in the installation CD, and type the following to start the installation:
    Code:
    su
    /sbin/modprobe tun
    qemu -boot d -hda image.img -localtime -net nic -net tap -m 192 -usb -soundhw sb16 -cdrom /dev/hdc;/etc/qemu-ifdown
    Where image.img was the name you gave to your image earlier. I'm also assuming /dev/cdrom is your CD drive - if it's not, then please change it to the correct device. After the install is complete, proceed to step 5.

    (5): Making the run script & running at will

    The last step is to create the QEMU start script and from there on you can run your guest OS at will. Create this file - called qemustart - in the same directory as your image:
    Code:
    #!/bin/sh
    su -c "/sbin/modprobe tun;qemu -boot c -hda image.img -localtime -net nic -net tap -m 192 -usb -soundhw sb16;/etc/qemu-ifdown"
    Where image.img was the name you gave to your image earlier.
    Last step - make the startup script executable:
    Code:
    chmod +x /path/to/qemustart
    Congratulations. You can now run your vitrual machine at any time simply by running this command:
    Code:
    /path/to/image/qemustart
    Enjoy!
    Firewing1
    Last edited by Firewing1; 25th May 2006 at 10:10 PM.
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  2. #2
    yur1022 Guest
    Excellent how-to!!!

    One may need bridge-utils:
    Code:
    yum install bridge-utils
    as su.

    Also
    Code:
    service firestarter stop
    service iptables stop
    in /etc/qemu-ifup may need to be replaced by
    Code:
    /sbin/service firestarter stop
    /sbin/service iptables stop
    yur

  3. #3
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very true - Thanks! I'm changing it...
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  4. #4
    Join Date
    Feb 2006
    Location
    Wake Forest, NC
    Age
    59
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the excellent how-to!! I have been looking to rid myself of WinBlows but there is one Windows application that is a MUST for me. I haven't been able to get it to work with wine and was not lookng to pay for VMware. I will be installing QEMU probably during the next week or two.

    Thanks Again!!
    PlutoNash

  5. #5
    Join Date
    Mar 2004
    Location
    Westland, Michigan
    Age
    49
    Posts
    2,317
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    was not lookng to pay for VMware
    VMWare server is Free. http://www.vmware.com/products/server/

    It's still listed as beta on the site, but its right from their existing products and they plan to keep it free forever going forward.

    In addition, Microsoft virtual Server 2005-R2is also free. http://www.microsoft.com/windowsserv...r/default.mspx


    For Linux usage, stick with VMWare over the MS Product. Must better support for LInux based-OS's.
    RHCE and MCSE systems administrator
    Registered Linux User #375155 For More Info or to register yourself

    My Linux box is:
    Ubuntu 8.04, Antec Sonata II case with 450-watt PS, AMD 64 X2 4600+ (65 watt), 4GB DDR2 800 RAM, 18X Lite-On DVD burner, Asus M2NPV-VM, Nvidia GeForce 7600GT (256MB), 320GB Western Digital SATA 3.0Gbps, Logitech MX-310, Dell 18" ultrasharp LCD, Microsoft Natural Ergonomic Keyboard 4000 and 2.1 Boston Acoustics sound system..

  6. #6
    OperatorOne Guest
    That's awesome. I use VMWare which is an expensive commercial version, but we have it at work so I get to use it free. Does this work as well as VMWare?

    I love the concept of virtual machines, and am currently using FC5 as my main OS with XP running in it with VMWare workstation 5. Also, can I build a smaller image, say 6gb instead of 10? VMware tries to force you to use a 16gb image for Windows, which is lame as my entire workstation setup is 3.9gb, so it would be nice to get that extra 10gb of space back on my thinkpad.

    Cheers

  7. #7
    OperatorOne Guest
    Blah. I went to install this and try it and Im using kernel 2222. Guess there's no packages for that yet. no worries. I'm not in a hurry to install windows again. hehe.

    cheers.

  8. #8
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by OperatorOne
    Blah. I went to install this and try it and Im using kernel 2222. Guess there's no packages for that yet. no worries. I'm not in a hurry to install windows again. hehe.

    cheers.
    Sorry, my fault - I forgot to change the path. QEMU 8.1 was released so the new modules are in a new folder. It's now all updated
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  9. #9
    Join Date
    Jan 2005
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is my recipe to use VMWare for free:

    * Download and install both vmware-workstation and vmware-player.

    * Use vmware-workstation to create and configure a new virtual machine; you do not even need a 'product activation key' to do this.

    * Now, use vmware-player to run that virtual machine.

    The only drawback that I am aware of is the hassel of having to go back and for between both programs, when you need to try different configurations. However, maybe you should read the fine print and verify that you are not violating any license by using this method...


    Hope this helps.

  10. #10
    OperatorOne Guest
    Technically VMWare workstation is trialware for 30days. I read somewhere that the VMWare server edition (which is listed as beta), never expires and uses the same codebase, so that would probably be your best bet if you want VMWare for free, then you don't have to bounce between that and the player.

    at work we build the images using VMWare WS and then install the player on the clientside and they transport their images on mobile hard drives.

  11. #11
    Join Date
    Jul 2005
    Location
    Vulcan
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do I check if kqemu is correctly installed?

    I tried to install win xp and after 6 hours waiting for it to install I gave up. Any suggestions?

    EDIT: /sbin/modprobe kqemu returns me an empty line.
    Last edited by Trek1701; 8th June 2006 at 12:18 AM.
    P.S. Never take candy from strangers... money is ok, but not candy.

    FC 12 - 64 bits

    Dell Vostro 1710 | Intel Core 2 Duo T9500 @ 2.60GHz | DDR 2GB | nVidia GeForce 8600M GS 512MB | WLAN Broadcom BCM4328 802.11a/b/g/n | Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller | Dell Wireless 360 Bluetooth | Seagate 5400rpm 160GB | Western Digital 5400rpm 320GB

    Maemo 5

    Nokia N900 | ARM Cortex A8 600 MHz | PowerVR SGX graphics | 32GB | Designed in Finland

  12. #12
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    su -
    lsmod | grep kqemu
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  13. #13
    Join Date
    Jul 2005
    Location
    Vulcan
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'v got:

    [root@fedora1 ~]# lsmod | grep kqemu
    kqemu 107908 0

    It means that kqemu is installed, right?
    P.S. Never take candy from strangers... money is ok, but not candy.

    FC 12 - 64 bits

    Dell Vostro 1710 | Intel Core 2 Duo T9500 @ 2.60GHz | DDR 2GB | nVidia GeForce 8600M GS 512MB | WLAN Broadcom BCM4328 802.11a/b/g/n | Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller | Dell Wireless 360 Bluetooth | Seagate 5400rpm 160GB | Western Digital 5400rpm 320GB

    Maemo 5

    Nokia N900 | ARM Cortex A8 600 MHz | PowerVR SGX graphics | 32GB | Designed in Finland

  14. #14
    Join Date
    Dec 2004
    Location
    Canada
    Age
    32
    Posts
    9,221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yup How fast is your computer, and how much RAM? On my 1.9GHz PC with 256 MB RAM (I told QEMU to use 192MB virtual ram, mind you, default is 128 which is considerably slower...) it took about 2 hours. You can specify the RAM amout for QEMU to use by adding the -m option:
    Code:
    qemu [ other options ] [ image file .img ] -m 192
    That would be 192 MB RAM.
    Firewing1
    [+] My open source software and blog
    [+] Some of my howtos: (for full list, click here)

  15. #15
    Join Date
    Jul 2005
    Location
    Vulcan
    Posts
    284
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1.4GHz with 256MB RAM

    I finally installed it. It was a long process, about 6 and a half hours...
    P.S. Never take candy from strangers... money is ok, but not candy.

    FC 12 - 64 bits

    Dell Vostro 1710 | Intel Core 2 Duo T9500 @ 2.60GHz | DDR 2GB | nVidia GeForce 8600M GS 512MB | WLAN Broadcom BCM4328 802.11a/b/g/n | Realtek RTL8111/8168B PCI Express Gigabit Ethernet controller | Dell Wireless 360 Bluetooth | Seagate 5400rpm 160GB | Western Digital 5400rpm 320GB

    Maemo 5

    Nokia N900 | ARM Cortex A8 600 MHz | PowerVR SGX graphics | 32GB | Designed in Finland

Page 1 of 7 123 ... LastLast

Similar Threads

  1. QEMU Virtual Machine Windows XP setup
    By morrislex in forum Using Fedora
    Replies: 0
    Last Post: 13th November 2008, 11:02 AM
  2. Replies: 4
    Last Post: 12th September 2007, 10:46 AM
  3. Using Ctrl+Alt+2 for QEMU Monitor on guest virtual machines
    By urcabraz in forum Servers & Networking
    Replies: 1
    Last Post: 1st July 2007, 03:10 AM
  4. Replies: 4
    Last Post: 27th December 2006, 02:09 PM
  5. [FC4] Qemu and Kqemu
    By Knudson in forum Using Fedora
    Replies: 13
    Last Post: 17th October 2005, 12:19 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
[[template footer(Guest)]]