IN THIS CHAPTER
Choosing an installation method
Installing a single- or multi-boot system
Performing a Live media installation of Fedora
Installing Red Hat Enterprise Linux
Understanding cloud-based installations
Partitioning the disk for installation
Understanding the GRUB boot loader
Installing Linux has become a fairly easy thing to do—if you are starting with a computer that is up to spec (hard disk, RAM, CPU, and so on) and you don't mind totally erasing your hard drive. Installation is more complex if you want to stray from a default installation. So this chapter begins with a simple installation from Live media and progresses to more complex installation topics.
To ease you into the subject of installing Linux, I cover three ways of installing Linux and step you through each process:
A fourth method of installation not covered in this chapter is to install Linux as a virtual machine on a virtualization host, such as Virtual Box or VMware system. Chapter 26 and 27 describe ways of installing or deploying a virtual machine on a Linux KVM host or in a cloud environment.
To try the procedures in this chapter along with me, you should have a computer in front of you that you don't mind totally erasing. As an alternative, you can use a computer that has another operating system installed (such as Windows), as long as there is enough unused disk space available outside that operating system. I describe the procedure, and risk of data loss, if you decide to set up one of these “dual boot” (Linux and Windows) arrangements.
You can get a Linux distribution that runs on handheld devices or an old PC in your closet with as little as 24MB of RAM and a 486 processor. To have a good desktop PC experience with Linux, however, you should consider what you want to be able to do with Linux when you are choosing your computer.
Be sure to consider the basic specifications you need for a PC-type computer to run the Fedora and Red Hat Enterprise Linux distributions. Because Fedora is used as the basis for Red Hat Enterprise Linux releases, hardware requirements are similar for basic desktop and server hardware for those two distributions.
NOTE
If you have a 486 machine (at least 100 MHz), consider trying Damn Small Linux (http://www.damnsmall-linux.org) or Slackware (http://www.slackware.org). It won't have the same graphical interface, but you could do some of the shell exercises. If you have a MacBook, try a GNOME version of Ubuntu that you can get at https://help.ubuntu.com/community/MacBook.
NOTE
PXE (pronounced pixie) stands for Preboot eXecution Environment. You can boot a client computer from a Network Interface Card (NIC) that is PXE-enabled. If a PXE boot server is available on the network, it can provide everything a client computer needs to boot. What it boots can be an installer. So with a PXE boot, it is possible to do a complete Linux installation without a CD, DVD, or any other physical medium.
If you're not sure about your computer hardware, there are a few ways to check what you have. If you are running Windows, the System Properties window can show you the processor you have, as well as the amount of RAM that's installed. As an alternative, with the Fedora Live CD booted, open a shell and type dmesg | less to see a listing of hardware as it is detected on your system.
With your hardware in place, you can choose to install Linux from a Live CD or from installation media, as described in the following sections.
In Chapter 1, you learned how to get and boot up Linux Live media. This chapter steps you through an installation process of a Fedora Live DVD so it is permanently installed on your hard disk.
Simplicity is the main advantage of installing from Live media. Essentially, you are just copying the kernel, applications, and settings from the ISO image to the hard disk. There are fewer decisions you have to make to do this kind of installation, but you also don't get to choose exactly which software packages to install. After the installation, you can add and remove packages as you please.
The first decisions you have to make about your Live media installation include where you want to install the system and whether you want to keep existing operating systems around when your installation is done:
The following procedure steps you through the process of installing the Fedora Live ISO described in Chapter 1 to your local computer. Because the Fedora 21 installation is very similar to the Red Hat Enterprise Linux 7 installation described later in this chapter, you can refer to that procedure if you want to go beyond the simple selections shown here (particularly in the area of storage configuration).
CAUTION
Before beginning the procedure, be sure to make backup copies of any data that you want to keep. Although you can choose to not erase selected disk partitions (as long as you have enough space available on other partitions), there is always a risk that data can be lost when you are manipulating disk partitions. Also, unplug any USB drives you have plugged into your computer because they could be overwritten.
Start the installation process from Live media.

Select configuration options from the Installation Summary screen.

Select Done when you have configured your storage.
By clicking the Advanced box, you can change some of the default settings. For example, with a user named chris, the default home directory would be /home/chris, and the next available user ID and group ID are assigned to the user. By selecting Advanced, you can change those settings and even assign the user to additional groups. Select Done when you are finished adding the user.
At this point, you can begin using the desktop, as described in Chapter 2. You can also use the system to perform exercises from any of the chapters in this book.
In addition to offering a live DVD, most Linux distributions offer a single image or set of images that can be used to install the distribution. For this type of installation media, instead of copying the entire contents of the medium to disk, software is split up into packages that you can select to meet your exact needs. A full installation DVD, for example, can allow you to install anything from a minimal system to a full-featured desktop to a full-blown server that offers multiple services.
In this chapter, I use a Red Hat Enterprise Linux 7 server edition installation DVD as the installation medium. Review the hardware information and descriptions of dual booting in the previous section before beginning your RHEL installation.
Follow this procedure to install Red Hat Enterprise Linux from an installation DVD.
This requires that you create a Red Hat account. If that is not possible, you can download an installation DVD from a mirror site of the CentOS project to get a similar experience: http://wiki.centos.org/Download.
For this example, I used the 3.4G RHEL 7 Server DVD ISO named rhel-server-7.0-x86_64-dvd.iso. After you have the DVD ISO, you can burn it to a physical DVD as described in Appendix A.
Choose from Localization, Software, and System topics on the Installation Summary screen.

You should now be able to log in to your Red Hat Enterprise Linux system. One of the first things you should do is get software updates for the new system.
When you install a Linux system on a physical computer, the installer can see the computer's hard drive, network interfaces, CPUs, and other hardware components. When you install Linux in a cloud environment, those physical components are abstracted into a pool of resources. So, to install a Linux distribution in an Amazon EC2, Google Compute Engine, or OpenStack cloud platform, you need to go about things differently.
The common way of installing Linux in a cloud is to start with a file that is an image of an installed Linux system. Typically, that image includes all the files needed by a basic, running Linux system. Metadata is added to that image from a configuration file or by filling out a form from a cloud controller that creates and launches the operating system as a virtual machine.
The kind of information added to the image might include a particular hostname, root password, and new user account. You might also want to choose to have a specific amount of disk space, particular network configuration, and a certain number of CPU processors.
Methods for installing Linux in a local cloud-like KVM environment are discussed in Chapter 26, “Using Linux for Cloud Computing.” Methods for deploying cloud images are contained in Chapter 27, “Deploying Linux to the Cloud.” That chapter covers how to run a Linux system as a virtual machine image on a KVM environment, Amazon EC2 cloud, or OpenStack environment.
If you were managing dozens, hundreds, even thousands of Linux systems in a large enterprise, it would be terribly inefficient to have to go to each computer to type and click through each installation. Fortunately, with Red Hat Enterprise Linux and other distributions, you can automate installation in such a way that all you need to do is turn on a computer and boot from the computer's network interface card to get your desired Linux installation.
Although we have focused on installing Linux from a DVD or USB media, there are many other ways to launch a Linux installation and many ways to complete an installation. The following bullets step through the installation process and describe ways of changing that process along the way:
Although installing Linux in enterprise environments is beyond the scope of this book, I want you to understand the technologies that are available when you want to automate the Linux installation process. Here are some of those technologies available to use with Red Hat Enterprise Linux, along with links to where you can find more information about them:
When you install RHEL, a kickstart file containing answers to all installation questions for the installation you just did is in the /root/anaconda-ks.cfg file. You can present that file to your next installation to repeat the installation configuration or use that file as a model for different installations.
See the RHEL Installation Guide for information on passing a kickstart file to the anaconda installer (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html-single/Installation_Guide/index.html#sect-parameter-configuration-files-kickstart-s390) and creating your own kickstart files (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Installation_Guide/index.html#s1-kickstart2-file).
Some of the installation topics touched upon earlier in this chapter require further explanation for you to be able to implement them fully. Read through the topics in this section to get a greater understanding of specific installation topics.
If you have an earlier version of Linux already installed on your computer, Fedora, Ubuntu, and other Linux distributions offer an upgrade option. Red Hat Enterprise Linux offers a limited upgrade path from RHEL 6 to RHEL 7.
Upgrading lets you move a Linux system from one major release to the next. Between minor releases, you can simply update packages as needed (for example, by typing yum update). Here are a few general rules before performing an upgrade:
TIP
Installing Linux from scratch goes faster than an upgrade. It also results in a cleaner Linux system. So, if you don't need the data on your system (or if you have a backup of your data), I recommend you do a fresh installation. Then you can restore your data to a freshly installed system.
Some Linux distributions, most notably Gentoo, have taken the approach of providing ongoing updates. Instead of taking a new release every few months, you simply continuously grab updated packages as they become available and install them on your system.
It is possible to have multiple operating systems installed on the same computer. One way to do this is by having multiple partitions on a hard disk and/or multiple hard disks, and then installing different operating systems on different partitions. As long as the boot loader contains boot information for each of the installed operating systems, you can choose which one to run at boot time.
CAUTION
Although tools for resizing Windows partitions and setting up multi-boot systems have improved in recent years, there is still some risk of losing data on Windows/Linux dual-boot systems. Different operating systems often have different views of partition tables and master boot records that can cause your machine to become unbootable (at least temporarily) or lose data permanently. Always back up your data before you try to resize a Windows (NTFS or FAT) filesystem to make space for Linux.
If the computer you are using already has a Windows system on it, quite possibly the entire hard disk is devoted to Windows. Although you can run a bootable Linux, such as KNOPPIX or Damn Small Linux, without touching the hard disk, to do a more permanent installation, you'll want to find disk space outside the Windows installation. There are a few ways to do this:
NOTE
Type yum install gparted (in Fedora) or apt-get install gparted (in Ubuntu) to install GParted. Run gparted as root to start it.
Before you try to resize your Windows partition, you might need to defragment it. To defragment your disk on some Windows systems, so that all your used space is put in order on the disk, open My Computer, right-click your hard disk icon (typically C:), select Properties, click Tools, and select Defragment Now.
Defragmenting your disk can be a fairly long process. The result of defragmentation is that all the data on your disk are contiguous, creating lots of contiguous free space at the end of the partition. Sometimes, you have to complete the following special tasks to make this true:
After your disk is defragmented, you can use commercial tools described earlier (Acronis Disk Director) to repartition your hard disk to make space for Linux. Or use the open source alternative GParted.
After you have cleared enough disk space to install Linux (see the disk space requirements described earlier in this chapter), you can install Ubuntu, Fedora, RHEL, or another Linux distribution. As you set up your boot loader during installation, you can identify Windows, Linux, and any other bootable partitions so you can select which one to boot when you start your computer.
Using virtualization technology, such as KVM, VMWare, VirtualBox, or Xen, you can configure your computer to run multiple operating systems simultaneously. Typically, you have a host operating system running (such as your Linux or Windows desktop), and then you configure guest operating systems to run within that environment.
If you have a Windows system, you can use commercial VMWare products to run Linux on your Windows desktop. Visit http://www.vmware.com/try-vmware to get a trial of VMWare Workstation. Then run your installed virtual guests with the free VMWare Player. With a full-blown version of VMWare Workstation, you can run multiple distributions at the same time.
Open source virtualization products that are available with Linux systems include VirtualBox (http://www.virtualbox.org), Xen (http://www.xen.org), and KVM (http://www.linux-kvm.org). VirtualBox was developed originally by Sun Microsystems. Some Linux distributions still use Xen. However, all Red Hat systems currently use KVM as the basis for Red Hat's hypervisor features in RHEL, Red Hat Enterprise Virtualization, and other cloud projects. See Chapter 26 for information on installing Linux as a virtual machine on a Linux KVM host.
When the anaconda kernel launches at boot time for RHEL or Fedora, boot options provided on the kernel command line modify the behavior of the installation process. By interrupting the boot loader before the installation kernel boots, you can add your own boot options to direct how the installation behaves.
When you see the installation boot screen, depending on the boot loader, press Tab or some other key to be able to edit the anaconda kernel command line. The line identifying the kernel might look something like the following:
vmlinuz initrd=initrd.img ...
The vmlinuz is the compressed kernel and initrd.img is the initial RAM disk (containing modules and other tools needed to start the installer). To add more options, just type them at the end of that line and press Enter.
So, for example, if you have a kickstart file available from /root/ks.cfg on a CD, your anaconda boot prompt to start the installation using the kickstart file could look like the following:
vmlinuz initrd=initrd.img ks=cdrom:/root/ks.cfg
For Red Hat Enterprise Linux 7 and the latest Fedora releases, kernel boot options used during installation are transitioning to a new naming method. With this new naming, a prefix of inst. can be placed in front of any of the boot options shown in this section that are specific to the installation process (for example, inst.xdriver or inst.repo=dvd).
For the time being, however, you can still use the options shown in the next few sections with the inst. prefix.
Sometimes, a Linux installation fails because the computer has some non-functioning or non-supported hardware. Often, you can get around those issues by passing options to the installer that do such things as disable selected hardware when you need to select your own driver. Table 9.1 provides some examples:
TABLE 9.1 Boot Options for Disabling Features
| Installer Option | Tells System |
| nofirewire | Not to load support for firewire devices |
| nodma | Not to load DMA support for hard disks |
| noide | Not to load support for IDE devices |
| nompath | Not to enable support for multipath devices |
| noparport | Not to load support for parallel ports |
| nopcmcia | Not to load support for PCMCIA controllers |
| noprobe | Not to probe hardware, instead prompt user for drivers |
| noscsi | Not to load support for SCSI devices |
| nousb | Not to load support for USB devices |
| noipv6 | Not to enable IPV6 networking |
| nonet | Not to probe for network devices |
| numa-off | To disable the Non-Uniform Memory Access (NUMA) for AMD64 architecture |
| acpi=off | To disable the Advanced Configuration and Power Interface (ACPI) |
If you are having trouble with your video display, you can specify video settings as noted in Table 9.2.
TABLE 9.2 Boot Options for Video Problems
| Boot Option | Tells System |
| xdriver=vesa | Use standard vesa video driver |
| resolution=1024x768 | Choose exact resolution to use |
| nofb | Don't use the VGA 16 framebuffer driver |
| skipddc | Don't probe DDC of the monitor (the probe can hang the installer) |
| graphical | Force a graphical installation |
By default, installation runs in graphical mode with you sitting at the console answering questions. If you have a text-only console, or if the GUI isn't working properly, you can run an installation in plain-text mode: By typing text, you cause the installation to run in text mode.
If you want to start installation on one computer, but you want to answer the installation questions from another computer, you can enable a vnc (virtual network computing) installation. After you start this type of installation, you can go to another system and open a vnc viewer, giving the viewer the address of the installation machine (such as 192.168.0.99:1). Table 9.3 provides the necessary commands, along with what to tell the system to do.
TABLE 9.3 Boot Options for VNC Installations
| Boot Option | Tells System |
| vnc | Run installation as a VNC server |
| vncconnect=hostname[:port] | Connect to VNC client hostname and optional port |
| vncpassword=<password> | Client uses password (at least 8 characters) to connect to installer |
You can boot the installation process from an installation medium that contains little more than the kernel and initial RAM disk. If that is the case, you need to identify the repository where the software packages exist. You can do that by providing a kickstart file or by identifying the location of the repositories in some way. To force the installer to prompt for the repository location (CD/DVD, hard drive, NFS, or URL), add askmethod to the installation boot options.
Using repo= options, you can identify software repository locations. The following examples show the syntax to use for creating repo= entries:
repo=hd:/dev/sda1:/myrepo Repository in /myrepo on disk 1 first partition repo=http://abc.example.com/myrepo Repository available from /myrepo on Web server repo=ftp://ftp.example.com/myrepo Repository available from /myrepo on FTP server repo=cdrom Repository available from local CD or DVD repo=nfs::mynfs.example.com:/myrepo/ Repository available from /myrepo on NFS share repo=nfsiso::nfs.example.com:/mydir/rhel7.iso Installation ISO image available from NFS server
Instead of identifying the repository directly, you can specify it within a kickstart file. The following are examples of some ways to identify the location of a kickstart file.
ks=cdrom:/stuff/ks.cfg Get kickstart from CD/DVD. ks=hd:sda2:/test/ks.cfg Get kickstart from test directory on hard disk (sda2) ks=http://www.example.com/ksfiles/ks.cfg Get kickstart from a Web server. ks=ftp://ftp.example.com/allks/ks.cfg Get kickstart from a FTP server. ks=nfs:mynfs.example.com:/someks/ks.cfg Get kickstart from an NFS server.
Here are a few other options you can pass to the installer that don't fit in a category.
rescue Instead of installing, run the kernel to open Linux rescue mode. mediacheck Check the installation CD/DVD for checksum errors.
For further information on using the anaconda installer in rescue mode (to rescue a broken Linux system), see Chapter 21, “Troubleshooting Linux.” For information on the latest boot options use in RHEL 7, refer to the RHEL 7 Installation Guide (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html-single/Installation_Guide/index.html#chap-anaconda-boot-options).
In large enterprise computing environments, it is common to store the operating system and data outside the local computer. Instead, some special storage device beyond the local hard disk is identified to the installer, and that storage device (or devices) can be used during installation.
Once identified, the storage devices you indicate during installation can be used the same way that local disks are used. You can partition them and assign a structure (filesystem, swap space, and so on) or leave them alone and simply mount them where you want the data to be available.
The following types of specialized storage devices can be selected from the Specialized Storage Devices screen when you install Red Hat Enterprise Linux, Fedora, or other Linux distributions:
While configuring these specialized storage devices is beyond the scope of this book, know that if you are working in an enterprise where iSCSI and FCoE devices are available, you can configure your Linux system to use them at installation time. The types of information you need to do this include:
The hard disk (or disks) on your computer provide the permanent storage area for your data files, application programs, and the operating system itself. Partitioning is the act of dividing a disk into logical areas that can be worked with separately. In Windows, you typically have one partition that consumes the whole hard disk. However, with Linux there are several reasons why you may want to have multiple partitions:
Multiple partitions also make doing certain kinds of backups (such as an image backup) easier. For example, an image backup of /home would be much faster (and probably more useful) than an image backup of the root filesystem (/).
TIP
When you create partitions for Linux, you usually assign the filesystem type as Linux native (using the ext2, ext3, ext4, or xfs type on most Linux systems). If the applications you are running require particularly long filenames, large file sizes, or many inodes (each file consumes an inode), you may want to choose a different filesystem type.
For example, if you set up a news server, it can use many inodes to store small news articles. Another reason for using a different filesystem type is to copy an image backup tape from another operating system to your local disk (such as a legacy filesystem from an OS/2 or Minix operating system).
Coming from Windows
If you have only used Windows operating systems before, you probably had your whole hard disk assigned to C: and never thought about partitions. With many Linux systems, you have the opportunity to view and change the default partitioning based on how you want to use the system.
During installation, systems such as Fedora and RHEL let you partition your hard disk using graphical partitioning tools. The following sections describe how to partition your disk during a Fedora installation. See the section “Tips for creating partitions” for some ideas for creating disk partitions.
Many Linux distributions give you the option of selecting different partition types when you partition your hard disk during installation. Partition types include:
RAID arrays can help improve performance, reliability, or both as those features relate to reading, writing, and storing your data.
The following sections describe how to add regular Linux partitions, LVM, RAID, and swap partitions using the Fedora graphical installer. If you are still not sure when you should use these different partition types, refer to Chapter 12 for further information on configuring disk partitions.
Different opinions exist relating to how to divide up a hard disk. Here are some issues to consider:
Changing your disk partitions to handle multiple operating systems can be very tricky, in part because each operating system has its own ideas about how partitioning information should be handled, as well as different tools for doing it. Here are some tips to help you get it right:
If you are using Linux as a desktop system, you probably don't need lots of different partitions. However, some very good reasons exist for having multiple partitions for Linux systems that are shared by lots of users or are public web servers or file servers. Having multiple partitions within Fedora or RHEL, for example, offers the following advantages:
Table 9.4 lists some directories that you may want to consider making into separate filesystem partitions.
TABLE 9.4 Assigning Partitions to Particular Directories
Although people who use Linux systems casually rarely see a need for lots of partitions, those who maintain and occasionally have to recover large systems are thankful when the system they need to fix has several partitions. Multiple partitions can limit the effects of deliberate damage (such as denial-of-service attacks), problems from errant users, and accidental filesystem corruption.
A boot loader lets you choose when and how to boot the operating systems installed on your computer's hard disks. The GRand Unified Bootloader (GRUB) is the most popular boot loader used for installed Linux systems. There are two major versions of GRUB available today:
The GRUB Legacy version is described in the following sections. After that, there is a description of GRUB 2.
NOTE
SYSLINUX is another boot loader you will encounter with Linux systems. The SYSLINUX boot loaders are not typically used for installed Linux systems. However, SYSLINUX is commonly used as the boot loader for Linux CDs and DVDs. SYSLINUX is particularly good for booting ISO9660 CD images (isolinux) and USB sticks (syslinux), and for working on older hardware or for PXE booting (pxelinux) a system over the network.
With multiple operating systems installed and several partitions set up, how does your computer know which operating system to start? To select and manage which partition is booted and how it is booted, you need a boot loader. The boot loader that is installed by default with Red Hat Enterprise Linux systems is the GRand Unified Boot loader (GRUB).
GRUB Legacy is a GNU boot loader (http://www.gnu.org/software/grub) that offers the following features:
At the time of this writing, GRUB version 1 is used in Red Hat Enterprise Linux 6. GRUB version 2 is used in Fedora, Ubuntu, Red Hat Enterprise Linux 7, and other Linux distributions. This section describes how to use GRUB version 1.
For more information on how GRUB works, at the command line type man grub or info grub. The info grub command contains more details about GRUB.
Booting with GRUB Legacy
When you install Linux, you are typically given the option to configure the information needed to boot your computer (with one or more operating systems) into the default boot loader. GRUB is very flexible to configure, so it looks different in different Linux distributions.
With the GRUB boot loader that comes with Red Hat Enterprise Linux installed in the master boot record of your hard disk, when the BIOS starts up the boot loader one of several things can happen:
If you want to change your boot options so they take effect every time you boot your computer, see the section on permanently changing boot options. Changing those options involves editing the /boot/grub/grub.conf file.
Temporarily changing boot options
From the GRUB Legacy boot screen, you can select to change or add boot options for the current boot session. On some Linux systems, the menu is hidden, so you have to press the Tab key or some other key (before a few seconds of timeout is exceeded) to see the menu. Then select the operating system you want (using the arrow keys), and type e (as described earlier).
Three lines in the example of the GRUB Legacy editing screen identify the boot process for the operating system you chose. Here is an example of those lines (because of the length of the kernel line, it is represented here as three lines):
root (hd0,0)
kernel /vmlinuz-2.6.32-131.17.1.el6.x86_64 ro
root=/dev/mapper/vg_myhost-lv_root
rd_NO_MD rd_NO_DM
LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc
KEYTABLE=us rhgb quiet crashkernel=auto
initrd /initramfs-2.6.32-131.17.1.el6.x86_64.img
The first line (beginning with root) shows that the entry for the GRUB boot loader is on the first partition of the first hard disk (hd0,0). GRUB represents the hard disk as hd, regardless of whether it is a SCSI, IDE, or other type of disk. In GRUB Legacy, you just count the drive number and partition number, starting from zero (0).
The second line of the example (beginning with kernel) identifies the kernel boot image (/boot/vmlinuz-2.6.32-131.17.1.el6.x86_64) and several options. The options identify the partition as initially being loaded ro (read-only) and the location of the root filesystem on a partition with the label that begins root=/dev/mapper/vg_myhost-lv_ root. The third line (starting with initrd) identifies the location of the initial RAM disk, which contains additional modules and tools needed during the boot process.
If you are going to change any of the lines related to the boot process, you will probably change only the second line to add or remove boot options. Follow these steps to do just that:
Permanently changing boot options
You can change the options that take effect each time you boot your computer by changing the GRUB configuration file. In RHEL and other Linux systems, GRUB configuration centers on the /boot/grub/grub.conf or /boot/grub/menu.lst file.
The /boot/grub/grub.conf file is created when you install Linux. Here's an example of that file for RHEL:
# grub.conf generated by anaconda # # Note you do not have to rerun grub after making changes to the file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/mapper/vg_joke-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu title Red Hat Enterprise Linux (2.6.32-131.17.1.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-131.17.1.el6.x86_64 ro root=/dev/mapper/vg_myhost-lv_root rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet crashkernel=auto initrd /initramfs-2.6.32-131.17.1.el6.x86_64.img title Windows XP rootnoverify (hd0,1) chainloader +1
The default=0 line indicates that the first partition in this list (in this case, Red Hat Enterprise Linux) is booted by default. The line timeout=5 causes GRUB to pause for five seconds before booting the default partition. (That's how much time you have to press e if you want to edit the boot line, or to press arrow keys to select a different operating system to boot.)
The splashimage line looks in the first partition on the first disk (hd0, 0) for the boot partition (in this case /dev/sda1). GRUB loads splash.xpm.gz as the image on the splash screen (/boot/grub/splash.xpm.gz). The splash screen appears as the background of the boot screen.
NOTE
GRUB indicates disk partitions using the following notation: (hd0,0). The first number represents the disk, and the second is the partition on that disk. So (hd0,1) is the second partition (1) on the first disk (0).
The two bootable partitions in this example are Red Hat Enterprise Linux and Windows XP. The title lines for each of those partitions are followed by the name that appears on the boot screen to represent each partition.
For the RHEL system, the root line indicates the location of the boot partition as the second partition on the first disk. So, to find the bootable kernel (vmlinuz-*) and the initrd initial RAM disk boot image that is loaded (initrd-*), GRUB mounts hd0,0 as the root of the entire filesystem (represented by /dev/mapper/vg_myhost-lv_root and mounted as /). There are other options on the kernel line as well.
For the Windows XP partition, the rootnoverify line indicates that GRUB should not try to mount the partition. In this case, Windows XP is on the first partition of the first hard disk (hd0,1) or /dev/sda2. Instead of mounting the partition and passing options to the new operating system, the chainloader +1 line tells GRUB to pass the booting of the operating system to another boot loader. The +1 indicates that the first sector of the partition is used as the boot loader. (You could similarly set up to boot a Windows Vista or Windows 7 operating system.)
Microsoft operating systems require that you use the chainloader to boot them from GRUB because GRUB doesn't offer native support for Windows operating systems.
If you make any changes to the /boot/grub/grub.conf file, you do not need to load those changes. GRUB automatically picks up those changes when you reboot your computer.
Adding a new GRUB boot image
You may have different boot images for kernels that include different features. In most cases, installing a new kernel package automatically configures grub.conf to use that new kernel. However, if you want to manually add a kernel, here is the procedure for modifying the grub.conf file in Red Hat Enterprise Linux to be able to boot that kernel:
# cd /usr/src/Linux-2.6.25.11/arch/i386/boot # cp bzImage /boot/bz-2.6.25-11
title Red Hat Enterprise Linux 6.3 (My own IPV6 build) root (hd0,4) kernel /bz-2.6.25-11 ro root=/dev/sda5 initrd /initrd-2.6.25-11.img
The advantage to this approach, as opposed to copying the new boot image over the old one, is that if the kernel fails to boot, you can always go back and restart the old kernel. When you feel confident that the new kernel is working properly, you can use it to replace the old kernel or perhaps just make the new kernel the default boot definition.
GRUB 2 represents a major rewrite of the GRUB Legacy project. It has been adopted as the default boot loader for Red Hat Enterprise Linux 7, Fedora, and Ubuntu. The major function of the GRUB 2 boot loader is still to find and start the operating system you want, but now much more power and flexibility is built into the tools and configuration files that get you there.
In GRUB 2, the configuration file is now named /boot/grub2/grub.cfg (in Fedora and other Linux systems using GRUB 2). Everything from the contents of grub.cfg to the way grub.cfg is created is different from the GRUB Legacy grub.conf file. Here are some things you should know about the grub.cfg file:
Comments in the grub.cfg file indicate where the content came from. For example, information generated from the /etc/grub.d/00_header file comes right after this comment line:
### BEGIN /etc/grub.d/00_header ###
In the beginning of the 00_header section, there are some functions, such as those that load drivers to get your video display to work. After that, most of the sections in the grub.cfg file consist of menu entries. The following is an example of a menu item from the grub.cfg file that you could select to start Fedora 20 when the system boots up:
menuentry 'Fedora (3.16.3-200.fc20.x86_64)' --class fedora
--class gnu-linux --class gnu --class os ...{
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root
eb31517f-f404-410b-937e-a6093b5a5380
linux /vmlinuz-3.16.3-200.fc20.x86_64
root=/dev/mapper/fedora_fedora20-root ro
rd.lvm.lv=fedora_fedora20/swap
vconsole.font=latarcyrheb-sun16
rd.lvm.lv=fedora_fedora20/root rhgb quiet
LANG=en_US.UTF-8
initrd /initramfs-3.16.3-200.fc20.x86_64.img
}
The menu entry for this selection appears as Fedora (3.16.3-200.fc20.x86_64) on the GRUB 2 boot menu. The --class entries on that line allow GRUB 2 to group the menu entries into classes (in this case, it identifies it as a fedora, gnu-linux, gnu, os type of system). The next lines load video drivers and file system drivers. After that, lines identify the location of the root file system.
The linux line shows the kernel location (/boot/vmlinuz-3.16.3-200.fc20.x86_64), followed by options that are passed to the kernel.
There are many, many more features of GRUB 2 you can learn about if you want to dig deeper into your system's boot loader. The best documentation for GRUB 2 is available on the Fedora system; type info grub2 at the shell. The info entry for GRUB 2 provides lots of information for booting different operating systems, writing your own configuration files, working with GRUB image files, setting GRUB environment variables, and working with other GRUB features.
Although every Linux distribution includes a different installation method, you need to do many common activities, regardless of which Linux system you install. For every Linux system, you need to deal with issues of disk partitioning, boot options, and configuring boot loaders.
In this chapter, you stepped through installation procedures for Fedora (using a live media installation) and Red Hat Enterprise (from installation media). You learned how deploying Linux in cloud environments can differ from traditional installation methods by combining metadata with prebuilt base operating system image files to run on large pools of compute resources.
The chapter also covered special installation topics, including using boot options and disk partitioning. With your Linux system now installed, Chapter 10 describes how to begin managing the software on your Linux system.
Use these exercises to test your knowledge of installing Linux. I recommend you do these exercises on a computer that has no operating system or data on it that you would fear losing (in other words, one you don't mind erasing). If you have a computer that allows you to install virtual systems, that is a safe way to do these exercises as well. These exercises were tested using a Fedora 21 Live media and an RHEL 7 Server Installation DVD.
CAUTION
Completing Exercise 4 ultimately deletes all content on your hard disk. If you want to use this exercise only to practice partitioning, you can reboot your computer before clicking Accept Changes at the very end of this procedure without harming your hard disk. If you go forward and partition your disk, assume that all data that you have not explicitly changed has been deleted.