You should have either an RPM or source package of GRUB somewhere on your disk. Go through the appropriate installation procedure for your system. GRUB should now be installed but not loaded. As root run:
# /sbin/grub-install /dev/hda
|
This will load GRUB into the master boot record of your disk. Now you need to edit /boot/grub/grub.conf to configure the GRUB boot menu:
default=0
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
title Red Hat Linux (2.4.7-10)
root (hd0,0)
kernel /vmlinuz-2.4.7-10 ro root=/dev/hda6
initrd /initrd-2.4.7-10.img
title Windows 98
map (hd0,0) (hd0,2)
map (hd0,2) (hd0,0)
rootnoverify (hd0,2)
chainloader +1
title DOS Boot Disk
map (hd0,0) (hd0,2)
map (hd0,2) (hd0,0)
chainloader (fd0)+1
|
Let's go through and see what this means.
"default=0" and "timeout=10" will cause Linux to boot in 10 seconds if you don't touch anything. "splashimage" is self-explanatory and not very important.
"title" denotes each boot setting and the text that follows is what will appear in your menu at startup. "root" specifies which partition contains your Linux kernel image (this may or may not be your actual root (/) partition). So, "root (hd0,0)" tells GRUB that the kernel is on the first partition of /dev/hda. You can see that GRUB has a funny numbering system, 0-3 for primary partitions and 4+ for logical partitions. The next line tells GRUB just where to find your kernel and where your actual root partition with your Linux system is. "initrd" tells where your init ramdisk image is located. Note that these few lines will probably be somewhat different if you don't have a separate /boot partition. Look at the GRUB info page if you need more help.
The "map" lines under the Windows 98 section are essential for getting your installation to work. These are the magical lines that trick Windows into believing that it's installed on the first partition of the first disk. If you don't map the Windows partition to (hd0,0), Windows will destroy your partition table and you won't be able to boot anything.
"rootnoverify" tells GRUB to boot from the Windows partition, but not to attempt to mount it, and "chainloader +1" tells GRUB to chain to Windows' bootloader which will start Windows.
The "DOS boot disk" section is needed if you are going to boot from floppy to begin the Windows install, but it will also come in handy after your install if you ever want to use a DOS boot disk for whatever reason. If your Windows install CD is bootable, you'll need to have a "Windows boot disk" section which chainloads to whatever your CDROM device is called.
Now save grub.conf and exit your text editor. Unlike LILO, GRUB does not require you to run any executable after you've modified the boot configuration. Now, with your emergency Linux boot disk handy, try rebooting your computer. When the system comes up you should see the GRUB menu with your three boot options. Select Linux. Hopefully, Linux will boot as usual and you'll have installed GRUB properly. If it doesn't, you thankfully have a Linux boot disk so that you can boot into Linux and fix your grub.conf. Once you've got GRUB successfully booting Linux, it's time to install Windows.