Boot Commands (Demo)

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
21 hours 25 minutes
Difficulty
Intermediate
CEU/CPE
21
Video Transcription
00:00
>> Hello, Cybrarians,
00:00
and welcome back to the Linux
00:00
Plus course here at Cybrary.
00:00
I'm your instructor Rob Gills,
00:00
and in today's lesson
00:00
>> we'll be discussing boot commands.
00:00
>> Upon completion of the lesson,
00:00
you'll be able to understand
00:00
boot commands and know when and how to use them.
00:00
Let's get right to it with some demo time.
00:00
In today's demo, we're
00:00
going to cover the following commands.
00:00
We're going to use grub2-install and grub2-mkconfig,
00:00
and we're going to run both of these
00:00
in the CentOS environment.
00:00
Without further ado, let's go ahead
00:00
and move over to the CentOS demo environment.
00:00
A little bit of a fib here.
00:00
We're not actually going to run grub2-install,
00:00
and I'm going to tell you why.
00:00
If you recall on newer versions of CentOS,
00:00
like CentOS 7 and CentOS 8,
00:00
grub2 is already installed,
00:00
so we don't need to run grub2-install.
00:00
That would only be used if you needed to
00:00
install a boot loader on a system
00:00
or a device that didn't already
00:00
have a boot loader installed on it,
00:00
and you want to install grub2.
00:00
In our case, we already have grub2 installed.
00:00
Remember on a CentOS system,
00:00
this is in boot/grub2, and we can navigate into that.
00:00
But first, we need to elevate our privileges.
00:00
So we're to become root,
00:00
we need to type in my password in order to
00:00
do that. There we are.
00:00
I just escalated my privileges,
00:00
I became root as my user account with a pseudo command.
00:00
Now what we can do is we can navigate into boot/grub2,
00:00
and then we can run an LS or list command,
00:00
and we can see all of the
00:00
>> lovely files that are in here.
00:00
>> What we're going to do is we'll actually
00:00
go ahead and create
00:00
a new copy of this grub.cfg file.
00:00
Because remember, the grub2-mkconfig command
00:00
is used to create that new configuration file.
00:00
It's going to use the contents of this boot directory,
00:00
it's also going to use the contents of SC default grub.
00:00
We can take a look at that, sc/default/grub.
00:00
Remember these are just our variables
00:00
that are stored here in this file.
00:00
It's also going to use the contents of
00:00
the directory, sc/grub.d.
00:00
These are all script files.
00:00
Remember we looked at this, we saw this in
00:00
a bun tube is pretty much the same here.
00:00
We have script files that are used to build and
00:00
configure that grub that CFG file.
00:00
Again, the new configuration is
00:00
created with grub2-mkconfig.
00:00
But before we do anything, let's go
00:00
ahead and make a backup here.
00:00
We're going to say, let's copy,
00:00
boot grub2grub.CFG
00:00
to boot grub2,
00:00
and we'll call it grub.CFG.older.
00:00
Now if we do an LS on boot grub2,
00:00
we can see grub.CFG.older.
00:00
If we wanted to now what
00:00
we can do is we can make a modification.
00:00
Let's go ahead and modify as the default grub.
00:00
What we're going to do in here is
00:00
we'll modify the timeout.
00:00
Instead of it being five seconds that it waits,
00:00
it's going to wait 10 seconds.
00:00
The way that I did this, I went into this using
00:00
Vim and go ahead and modify anything in Vim,
00:00
you have to hit "I" for insert,
00:00
there a few other ways you can get around in here,
00:00
but that's the most common.
00:00
I just navigate to where I wanted to be and
00:00
hit "I" for insert,
00:00
and then I can start typing.
00:00
I want to change 5-10 and I'm going to escape.
00:00
Then I'm going to type :WQ,
00:00
:WQ will write and quit out of this file.
00:00
We can run less on this file again.
00:00
We can see that our grub timeout has now changed to 10.
00:00
That's good. Now when we run grub2-mkconfig,
00:00
it's going to pick up the changes we just made.
00:00
Then we can use those changes
00:00
to update the grub.CFG file.
00:00
I'll show you how to do this.
00:00
We're going to run grub2-mkconfig.
00:00
I'm actually using something called Tab completion
00:00
so that I don't have to type out the entire command.
00:00
You can start typing and then hit Tab and it will
00:00
complete the command for you
00:00
so that you don't have to type everything.
00:00
We're going to do grub2-mkconfig -O for output,
00:00
and we're going to tell it we're going to put this
00:00
in our boot grub2 directory,
00:00
and we'll call this one grub.CFG.newer.
00:00
It's going to create the grub configuration
00:00
file and it's done.
00:00
Let's do an LS.
00:00
Now we can see grub.CFG.newer right here.
00:00
What we're actually going to do
00:00
is we're just going to copy
00:00
this right over our existing grub.com file.
00:00
But that's why we made a backup.
00:00
If anything goes wrong,
00:00
we can always revert it.
00:00
We're going to go ahead and do copy,
00:00
or you do copy grub.CFG.newer.
00:00
We're going to move that over grub.CFG.
00:00
Now if we reboot the system,
00:00
we should be able to see that it takes
00:00
10 seconds for the window to go by. Let's get a shot.
00:00
Now, the virtual box image,
00:00
it's going to reboot here.
00:00
You're going to see a virtual box message.
00:00
Then it should come up into our boot menu.
00:00
If you sit here and wait,
00:00
you can see it counting down
00:00
>> 6, 5, 4, 3, 2, 1.
00:00
>> That change did go in place.
00:00
We were able to change that to
00:00
10 seconds and we were able to get
00:00
our system reconfigure there
00:00
in terms of the way our boot operates.
00:00
But with that being said in today's lesson,
00:00
we covered the boot commands
00:00
that are covered on Linux plus
00:00
exam blueprint including
00:00
grub2-install and grub2-mkconfig.
00:00
We learned a little bit about when
00:00
and how to use these commands.
00:00
Thank you for being here and I look
00:00
forward to seeing you in the next lesson.
Up Next