Linux CentOS 5/6 startup process

Source: Internet
Author: User
Tags network function

CentOS 5/6 Startup process

1. Power-On self-test (POST)
The system hardware is detected by the CMOS chip BIOS system after power on

2. Find system Boot
2.1 Boot settings boot sequence in the BIOS in order to find the boot program, start with the first boot program device;

2.2 Load bootloader, select the kernel version to be loaded by bootloader, load the kernel version of the user selection into a specific location in memory, unzip the expansion, and then transfer the control to the kernel
(1) MBR boot program
446 bytes: bootloader
64 bytes: Partition table
2: End Mark 55AA
(2) GRUB: multiple OS Manager
bootloader:1st Stage
disk:2nd Stage

3. Boot the kernel
3.1 Kernel Features: process management, memory management, network management, drive management, file system, security features

3.2 Linux kernel Features:
(1) Modular design, and the modules can be dynamically unloaded and loaded;
(2) kernel core files are/boot/vmlinuz-version-release and RAMDisk. The path to RAMDisk in CentOS 5 is/BOOT/INITRD. VERSION-RELEASE.IMG, the path in CentOS 6 is/boot/initramfs-version-release.img
(3) module file exists path/lib/modules/version-release

3.3 Kenel Self-initialization process
(1) Detecting all the hardware devices that can be identified;
(2) Load the hardware driver; (possibly with ramdisk load driver)
(3) Mount with file system in read-only mode
(4) Running user space the first application/sbin/init

The 3.4 init program type differs according to the system in the following ways:
(1) CentOS 5 uses SYSV, configuration file path/etc/inittab
(2) CentOS 6 uses upstart, configuration file path/etc/inittab/etc/init/*.conf
(3) CentOS 7 uses systemd, configuration file path/usr/lib/systemd/system/etc/systemd/system

3.5 CentOS 5/6 RunLevel
Divided into 0-6, seven levels
0: Turn off the machine,
1: Single-user mode (login is the root user, no user password Authentication required), can enter the command 1 or one, can also be called maintenance mode
2: Multi-user mode, which starts the network function but does not start NFS or is called Maintenance mode
3: Multi-user mode, 3 in normal mode, only start the text interface
4: Reserved level, same as 3;
5: Multi-user mode, can start the graphical interface;
6: Restart

3.6 Init's toggle command and Configuration Resolution
(1) INIT #: General mode level is 3,5, #为级别编号;
(2) RunLevel: View the current RunLevel and the level before the most recent switch
(5) Who-r: similar to RunLevel

3.7/etc/inittab configuration file parsing
Id:runlevel:action:process
ID: Unique identifier for each registered item
RunLevel: Corresponds to 0-6, 7 operating levels
Action: A condition that indicates that the corresponding registration item runs the process under certain conditions
Wait: Process runs once after entering the specified runlevel and the process aborts when you leave this runlevel
Respawn: When the process terminates, start a new
Initdefault: Set default run level, process omitted
Sysinit: System initialization, only when the system starts or restarts the time will only run once, here is generally specified/etc/rc.d/rc.sysinit
Analysis:
Id:3:initdefault:-------> Indicates that it will enter 3 mode (i.e. command line mode) by default after booting
Si::sysinit:/etc/rc.d/rc.sysinit-----> init will rely on/etc/rc.d/rc.sysinit this script to initialize the system at all operating levels.
The role of/etc/rc.d/rc.sysinit is as follows:
1, activate Udev and SELinux
2, set kernel parameters according to/etc/sysctl.conf file
3, set the system clock
4, keyboard key mapping, that is, identify the keyboard
5, enable swap partition
6, set host name
7, root file system detection and re-read and write Mount
8. Activate RAID and LVM devices
9, enable disk quotas
10, detect and mount other file systems (mount the devices defined in/etc/fstab)
11. Purge expired locks and PID files
L0:0:WAIT:/ETC/RC.D/RC 0
L1:1:WAIT:/ETC/RC.D/RC 1
L2:2:WAIT:/ETC/RC.D/RC 2
L3:3:WAIT:/ETC/RC.D/RC 3
L4:4:WAIT:/ETC/RC.D/RC 4
L5:5:WAIT:/ETC/RC.D/RC 5
L6:6:WAIT:/ETC/RC.D/RC 6
The above 10-16 means that when the n level is entered, the s* file under/ETC/RC.D/RC*.D is enabled, the k* file is disabled, and only once for the corresponding level, exiting this level is invalid. Each/ETC/RC.D/RC*.D
k*:k##:# #表示关闭次序, the larger the number, the smaller the number of services, usually the service that relies on people than
s*:s##:# #表示启动次序, the smaller the number of the first run, the smaller the number of services, usually for others to rely on services.

3.8 chkconfig Command
Purpose: Used to view the status of the service at the level of startup or shutdown, and to set the status of each service at each boot level

Use Scenario 1:
(1) chkconfig--list: View all servers at each level state, the number at the top indicates the start level, on means start, off indicates off
(2) Chkconfig--list Name: Indicates the status of the service at each level.
(3) Chkconfig--level # name <on,off,reset>: Modifies the state of the service at the specified level #, when the # number is omitted, represents 2345.
(4) Ways to add new services and delete services:
First put the added script in/etc/rc.d/(/ETC/INIT.D), edit the state of the script at all levels chkconfig:llll nn nn
Add a script using Chkconfig--add name
Delete a script using Chkconfig--del name

Note: At normal level, the last start of a service s99local does not link to/etc/rc.d/init.d a service script, but instead points to the/etc/rc.d/rc.local script, so inconvenient or not required to write as a service script placed in/etc/rc.d/ Init.d/directory, and also want to start the automatic operation of the command, can be placed directly in the/etc/rc.d/rc.local file;

This article from "The Boundless" blog, declined reprint!

Linux CentOS 5/6 startup process

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.