How to install Windows alongside Linux?

I know that there is a way in which, one can install Linux or Ubuntu on Windows easily but, what about installing Windows on Linux or Ubuntu i.e If I have a machine with only Ubuntu, how can I install Windows on it without removing Ubuntu?

I don't want to do this in a Virtual Machine. I just want to have two OS in a single hard drive.


Solution 1:

You can install Windows from inside Linux onto your physical hard drive, but you need separate partition as NTFS or FAT32. Below is a way to use a virtual machine to do the actual installation, but it's performed on your hard drive.

  1. Prepare a new partition onto where you want to install Windows.
  2. Start the Windows installation with a Qemu virtual machine and your physical hard drive mapped (target partition can't be mounted):

    qemu -hda /dev/sda -cdrom winxp.iso -m 1G -boot d --enable-kvm
    
  3. Install Windows on the partition you created.

  4. Reinstall Grub (if partition isn't first, you need to do a trick with mapping hd's, its working for me).

Solution 2:

You will need:

  • CD or USB stick containing GParted (see below)
  • Windows DVD or USB stick (of course)
  • Ubuntu Live CD or Live USB, version 10.04 or later

First use GParted to free some space to host Windows:

Install Windows as usual selecting the space you just created using GParted. This will "activate" only Windows and Ubuntu will not be accessible at this point. To make Ubuntu accessible again, take the Ubuntu Live CD and follow this guide (or see this question or this or that help wiki page.).