Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
CentOS 7 Linux Server Cookbook, Second Edition

You're reading from   CentOS 7 Linux Server Cookbook, Second Edition Get your CentOS server up and running with this collection of more than 80 recipes created for CentOS 7 - essential for Linux fans!

Arrow left icon
Product type Paperback
Published in Jan 2016
Publisher
ISBN-13 9781785887284
Length 326 pages
Edition 2nd Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Jonathan Hobson Jonathan Hobson
Author Profile Icon Jonathan Hobson
Jonathan Hobson
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Installing CentOS FREE CHAPTER 2. Configuring the System 3. Managing the System 4. Managing Packages with YUM 5. Administering the Filesystem 6. Providing Security 7. Building a Network 8. Working with FTP 9. Working with Domains 10. Working with Databases 11. Providing Mail Services 12. Providing Web Services 13. Operating System-Level Virtualization 14. Working with SELinux 15. Monitoring IT Infrastructure Index

Getting started and customising the boot loader

When you turn on your computer, the boot loader is the first program that starts up and is responsible for loading and transferring control to an underlying operating system. Nowadays, almost any modern Linux distribution uses the GRand Unified Bootloader version 2 (GRUB2) for starting the system. It has a lot of flexibility in configuration and supports a lot of different operating systems. In this recipe, we will show how to customize the GRUB2 boot loader by disabling the waiting time of the menu display and therefore improving the time it takes for booting the system.

Getting ready

To complete this recipe, you will require access to an already installed CentOS 7 operating system (minimal or any other CentOS 7 installation type will work) with root privileges. Also, you need to have some basic experiences with a text based editor, such as nano, for changing the configuration files.

How to do it...

We begin this recipe by opening the main GRUB2 configuration file with our text editor of choice and modifying it.

  1. First log in as root into your system and create a copy of the GRUB2 configuration file for backup and rollback, if needed. Press the Return key to finish:
    cp /etc/default/grub /etc/default/grub.BAK
    
  2. Open the main GRUB2 configuration file that we want to edit with the following command and press the Return key (here we will use the editor nano, if you have not installed it yet type yum install nano):
    nano /etc/default/grub
    
  3. Press the Return key in the first line where the cursor is at to insert a new line at the top, and then insert the following line:
    GRUB_HIDDEN_TIMEOUT=0
    
  4. Add a # sign to the beginning of the following line, as shown:
    GRUB_TIMEOUT=0
    
  5. Now save the file in the nano using Ctrl+o (and Return to confirm the filename to save). Use Ctrl+x to exit the editor and then run the following command:
    dmesg | grep -Fq "EFI v"
    
  6. If the preceding command does not produce any output, run the following command:
    grub2-mkconfig -o /boot/grub2/grub.cfg
    
  7. Otherwise, if there is an output, run:
    grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
    
  8. If grub2-mkconfig is successful, it will print Done. Now reboot your system using the following command:
    reboot
    
  9. During the rebooting process, you will notice that the GRUB2 boot menu will not appear any more and the system will boot up faster.

How it works...

Having completed this recipe, we now know how to customize the GRUB2 boot loader. In this very easy recipe, we only showed you very basic modifications to the boot loader but it can do much more! It supports a broad variety of filesystems and can boot almost any compatible operating system. This is also particularly useful if you plan to run multiple operating systems on the same machine. To learn more about GRUB2's configuration file syntax type the info grub2 | less command and go to the section 6.1 Simple configuration handling (read the recipe Navigating text files with less in Chapter 2, Configuring the System to learn how to browse this document).

You have been reading a chapter from
CentOS 7 Linux Server Cookbook, Second Edition - Second Edition
Published in: Jan 2016
Publisher:
ISBN-13: 9781785887284
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image