Installing GRUB

Installing GRUB involves two stages. First, you install the GRUB files on your system, either by compiling and installing the source tarball or from a package. That puts the GRUB files in the correct locations on your system. The second step is to install the GRUB software as your boot manager. This is the step we describe in this section.

If you installed GRUB as part of your Linux installation, the distribution’s installation program took care of both stages of installing GRUB, and you’ll see the GRUB menu when you boot Linux. If you didn’t install GRUB as part of your Linux installation, you have two choices. The easiest way to install GRUB is with the grub-install shell script that comes with GRUB. If grub-install doesn’t work, or if you want to do the installation manually, you can run the grub command and issue the installation commands yourself.

The following sections describe how to create a GRUB boot CD, a GRUB boot floppy, and how to install GRUB. You can create a GRUB boot disk for everyday use or to have for an emergency.

Creating a GRUB boot CD

The following instructions make a CD that boots to GRUB:

  1. Make a directory that will hold the GRUB iso image to be written to CD:

    $ mkdir -p grubiso/boot/grub     # make parent dirs if needed
  2. Copy the file stage2_eltorito[3] to the new directory from the directory where GRUB was installed (in this example /usr/lib/grub/x86_64-pc):

    $ cp /usr/lib/grub/x86_64-pc grubiso/boot/grub

    You can move other files to the directory as well, ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.