Go to the first, previous, next, last section, table of contents.
Caution: This procedure is definitely deprecated, because there are several posibilities that your computer can be unbootable. For example, most operating systems don't tell GRUB how to map BIOS drives to OS devices correctly, GRUB merely guesses the mapping. This will succeed in most cases, but not always. So GRUB provides you with a user-defined map file called device map, which you must fix, if it is wrong. See section The map between BIOS drives and OS devices, for more details.
Unfortunately, if you do want to install GRUB under a UNIX-like OS (such as GNU), invoke the program @command{grub-install} (see section Invoking grub-install) as the superuser (root).
The usage is basically very easy. You only need to specify one argument to the program, namely, where to install GRUB. The argument can be either of a device file or a GRUB's drive/partition. So, this will install GRUB into the MBR of the first IDE disk under Linux:
# grub-install /dev/hda
Likewise, under Hurd, this has the same effect:
# grub-install /dev/hd0
If it is the first BIOS drive, this is the same as well:
# grub-install '(hd0)'
But all the above examples assume that you use GRUB images under the root directory. If you want GRUB to use images under a directory other than the root directory, you need to specify the option @option{--root-directory}. The typical usage is that you create a GRUB boot floppy with a filesystem. Here is an example:
# mke2fs /dev/fd0 # mount -t ext2 /dev/fd0 /mnt # grub-install --root-directory=/mnt '(fd0)' # umount /mnt
Another example is in case that you have a separate boot partition which is mounted at `/boot'. Since GRUB is a boot loader, it doesn't know anything about mountpoints at all. Thus, you need to run @command{grub-install} like this:
# grub-install --root-directory=/boot /dev/hda
By the way, as noted above, it is quite difficult to guess BIOS drives correctly under a UNIX-like OS. Thus, @command{grub-install} will prompt you to check if it could really guess the correct mappings, after the installation. The format is defined in section The map between BIOS drives and OS devices. Please be careful enough. If the output is wrong, it is unlikely that your computer can boot with no problem.
Note that @command{grub-install} is actually just a shell script and the real task is done by the grub shell @command{grub} (see section Invoking the grub shell). Therefore, you may run @command{grub} directly to install GRUB, without using @command{grub-install}. Don't do that, however, unless you are very familiar with the internals of GRUB. Installing a boot loader on a running OS may be extremely dangerous.
Go to the first, previous, next, last section, table of contents.