Linux basics-initialization and service of Unit 10 system, linux Initialization
Unit 10 system initialization and service
Linux boot sequence
Linux boot sequence
BOIS initialization and Boot Loader
What is BIOS?
GRUB program and grub. conf file
What is grub?
Grub configuration file grub. conf
Kernel initialization and init Initialization
Init configuration file/etc/inittab
Work to be done by the init program
Run levels)
Functions of each running level
Shut down and restart the system
Shut Down System commands
Command to restart the system
Change User Password in single-user mode
Rescue Mode
Homework
[Content of this section]
1. Linux system boot sequence (For details, refer to linux System Management P312)
MBR hard disk read Diagram
1) understand the Linux system boot sequence: (see Appendix 1)
The BIOS is used to check the computer's hardware devices, such as CPU, memory, and fan speed;
The MBR will be in 1st blocks of the boot disk and the size is B.
512B
446: boot Information
64: partition information
2: Flag Space
Among them, the program code in the first 446 is used to select the boot partition, that is, the partition used to load the boot Code;
The kernel is mainly used to install drivers for computer devices so that the operating system can control devices on the computer. Mount the/(Root) File System in read-only mode, that is, the operating system can only read the partition where the root file system (directory) is located;
The process id of the init program is 1, that is, 1st programs executed in the Linux operating system.
1. BOIS initialization and boot loader (for details, see linux System Management P313)
1) grasp the definition of BIOS: BIOS (Basic Input/Output System) (abbreviation of Basic Input/Output System), which is an interface between hardware and software, it is also a very basic interface.
2. GRUB program and grub. conf file (for details, see linux System Management P317)
1) grasp the definition of GRUB: GRUB is the abbreviation of Grand uniied Bootloader (Multi-operating system startup manager.
2) Master grub configuration file: grub. conf
Set the grub Md5 encryption command
Password = plaintext or password -- md5 ciphertext (edit the Password of the grub configuration file)
Title red hat Title
Password = plaintext or password -- md5 ciphertext (Password required for Kernel boot loading)
3. kernel initialization and init initialization (for details, see linux System Management P322)
1) the configuration file for init is/etc/inittab.
2) understand the work to be done by the init program:
A) determines the run levels to be used by default ).
# View the running level
[Root @ study ~] # Runlevel
N 3
# Modify the startup level
Vi/etc/init
Id: 3: initdefault
B) execute some system initialization scripts (programs) to initialize the operating system.
C) execute the program in the corresponding directory according to the settings of run level to determine which services to start.
D) set some key combinations.
E) define the UPS uninterruptible power supply system, that is, the programs to be executed when a power supply problem occurs or when the power supply recovers.
# After the system is powered off, the system will generate a. inittab. swp file, resulting in startup failure.
[Root @ study ~] # Rm-rf/etc/. inittab. swp
[Root @ study ~] # Vi/etc/inittab
# Default runlevel. The runlevels used are:
#0-halt (Do NOT set initdefault to this)
#1-Single user mode
#2-Multiuser, without NFS (The same as 3, if you do not have networking)
#3-Full multiuser mode
#4-unused
#5-X11
#6-reboot (Do NOT set initdefault to this)
#
Id: 3: initdefault: # Change 3 to 5 and enter the graphic interface.
F) generate six virtual machines, that is, tty1 ~ Tty6.
4. run levels (run level) (See linux System Management P326)
1) master all running levels and functions corresponding to each running level:
5. Shut down the system and restart the system (For details, refer to linux System Management P342)
1) Master Common commands that can shut down the system:
Shutdown-h now
Halt
Poweroff
Init 0
2) Master Common commands that can restart the system:
Shutdown-r now
Reboot
Init 6
Ctrl + Alt + Delete
6. Master the single-user mode and change the user's password
# Single-user mode
Press any key ---- e ----> select the second line of kernel ----> press e, then press space> enter 1 ---- then enter B
# View the running level
Runlevel
1 $
# Change Password
Passwd root
# Restart
Reboot
7. Master the rescue mode
1. Insert the optical drive ISO
2. Press F2 to start the drive quickly.
3. Restart the server
4. Start the system on the user's CD and select rescue installed system
5. Some column-related settings will be set after startup:
Language settings:
Keyboard settings:
Enable or disable NIC:
Let's talk about the description. Click continue:
If you are prompted to mount the previous system to/mnt/sysimage, click OK to proceed to the next step:
The previous system has been mounted to/mnt/sysimage. Click OK:
Select shell start shell and click OK to enter the linux rescue mode:
Modify grub. conf to delete or cancel the previous grub protection password.
Restart the system and reset the root password in single-user mode:
You can reset the password again.
8. Homework (70 minutes)
1) log on to the system as a root user
2) modify the grub configuration file. By default, it is started with 1st operating systems and the default reading seconds is changed to 10 seconds.
[Root @ study ~] # Vi/etc/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this 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/sda3
# Initrd/initrd-[generic-] version. img
# Boot =/dev/sda
Default = 0
Timeout = 10
Splashimage = (hd0, 0)/grub/splash.xpm.gz
# Boot =/dev/sda
Default = 0
Timeout = 5 # system entry time
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Password -- encrypted $6 $ bwpMzA6qyot6Fem4 $ F1bD/queues. 4zBDRfPKESWGFgv8sNsf5i1
Title CentOS 6 (2.6.32-504. el6.x86 _ 64)
Root (hd0, 0)
@
"/Etc/grub. conf" 18L, 930C written
3) set the ciphertext password "123" in the grub menu"
[Root @ study ~] # Grub-md5-crypt
Password:
Retype password:
$1 $ D/gW2/$ aFrbVkK8itwGxpg3UEqwg1
[Root @ study ~] # Vi/etc/grub. conf
# Grub. conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this 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/sda3
# Initrd/initrd-[generic-] version. img
# Boot =/dev/sda
Default = 0
Timeout = 5 # system entry time
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Password -- $1 $ D/gW2/$ aFrbVkK8itwGxpg3UEqwg1 # Set the password
Password -- encrypted $6 $ bwpMzA6qyot6Fem4 $ F1bD/queues. 4zBDRfPKESWGFgv8sNsf5i1
Title CentOS 6 (2.6.32-504. el6.x86 _ 64)
Root (hd0, 0)
Kernel/vmlinuz-2.6.32-504.el6.x86_64 ro root = UUID = db12d77f-2b16-4a49-b848-3200e873fecd rd_NO_LUKS rd_NO_LVM LANG = en_US.UTF-8 rd_NO_MD SYSFONT = latarcyrheb-sun16 crashkernel = auto KEYBOARDTYPE = pc KEYTABLE = us rd_NO_DM rhgb quiet
Initrd/initramfs-2.6.32-504.el6.x86_64.img
4) modify the default running level of the system to 3.
5) restart the system using commands related to the running level
Reboot or init 6
6) change the user's password to "123" in single-user mode"
7) Use Rescue mode to delete the grub menu Password