Saturday, February 27, 2010

How to install Windows XP in an existing Linux machine.

Intro:
Installing Linux in an existing Windows Machine is not at all a big deal, rather it is quiet straight forward. You just have to leave some hard disk space for Linux and install it on the remaining hard disk space. The Linux boot loader is INTELLIGENT enough to identify that a Windows OS is already installed there and it will automatically adjust the boot loader "GRUB" for dual booting.

However our famous Windows operating systems are not that intelligent but clumsy and it will delete the whole boot loader "GRUB" completely. We will reinstall the GRUB and edit the /etc/grub/grub.conf file to correct it.

I want to go generalized and this how-to is applicable for any version of Linux using GRUB bootloader and windows os. However here I used Ubuntu 9.1 and Windows Server 2003 both 32 bit.

The First step: Back up grub.conf file
Just to be prepared to face the worst case of losing the gurb data, back-up the copy of grub.conf file. In your Linux machine:

# cp /etc/grub/grub.conf /usb

Where /usb is the folder where I have mounted my pen-drive. Anyway keep your grub.conf file in a safe custody. You can even copy it to a different location in the same disk..

The Second step: Make space for windows installation
Our next step towards dual boot is to create space for the Windows 2003. Free hard disk space of 2 GB is enough for installing Windows 2003 but 5 GB space is preferred for usage.
here for the sake of simplicity I guess you have enough hard disk space left for installation. If not you have to rezise any of the partition.
I will explain partition resizing in another post!!!!!

The Third step: Installing Windows.
As you can guess it is installing the Windows Server 2003. Installing a Windows operating system is quiet straight forward and it does not require a how to...... How ever you should be careful when selecting the installation destination, I mean hard disk space for installation.

One message will be displayed stating "Active partition on your computer contains another operating system. To successfully complete the installation of windows, setup will mark this partition as inactive." Leave it and press "enter" to continue. Select the "Unpartitioned space" from the set up menu.. REMEMBER this is very important you should not select any other partitions labeled "Unknown". Those are actually Linux partitions and it should not be disturbed.

As in the above figure select the the Unpartitioned space, press enter and continue installation as usual. Now this partition may not be sensed as "C" drive. It will not create any issue with new applications (softwares that you may install on the OS) but some horribly applications may raise a complaint about it. To counter it, you can the system drive letter but it is recommended. Else you can create a NTFS partition in Linux, make it "primary" and install the Windows in it. Well you should have done it in the second step it self!!!

The Forth step: Installing GRUB.
After installing Windows 2003, the system will comfortably boot into windows and there won't be any sign of our bellowed Linux ox. Yea this is why I called Windows "Not that much Intelligent". But we have work through for it. You have to insert your Linux installation cd and boot from it.

For Ubuntu:-
Boot from the cd and choose "Try Ubuntu without any change to your computer".
Open up a Terminal via:- Application --> Accessories --> Terminal and enetr into grub configuration mode by typing "sudo grub".

Type in the following command in same order:

root (hd0,0)
setup (hd0)
quit
exit

Now remove the disk and reboot the machine. You will get the GRUB bootloader but the Windows Server 2003 will not be there in the list. Boot in to Ubuntu and edit the /etc/grub/grub.conf. Add the following lines to it.

title Windows Server 2003
root (hd0,1)
makeactive
chainloader +1


If you want to make the GRUB menu always available, boot back into Ubuntu and edit the MENU.LST file. Find the hiddenmenu text string and comment it like #hiddenmenu.
To increase the menu timeout, change the default timeout 3 to a higher value.
For RedHat Enterprise Linux:
Even though I have selevted Ubuntu 9.1 as my platform here, thisthing will work for every Linux platforms. For example in RedHat Enterprise Linux do as follows:

Boot using the RHEL installation CD/DVD and get into Linux Rescue mode by typing linux rescue in boot menu.

boot: linux rescue
You will get the single usermode shell as
sh-3.1#
Mount the real root directory via
sh-3.1# chroot /mnt/sysimage

Install GRUB via
sh-3.1# /sbin/grub-install /dev/sda

After successful installation reboot the system. Like I told before You won't see the Windows OS. Boot into RHEL itself and edit the /etc/grub/grub.conf file. Add the following lines to it.

title Windows Server 2003
root noverify (hd0,3)
chainloader +1

Reboot the machine. Hit 'esc' while booting to get into boot select menu and choose whatever RHEL or Windows server.

No comments:

Post a Comment