
#What is the CentOS system startup process?
When we press the power button, do we understand the secret behind the system? Here, I will take you to explore the secrets behind booting the Linux system.

1. Power-on self-test
After the motherboard is powered on, the system first uses the POST program to check various internal devices. Check, if any error is found during the self-check, it will be handled in two situations: for serious faults (fatal faults), it will shut down. At this time, because various initialization operations have not been completed, no prompts or signals can be given; for non- If a serious fault occurs, a prompt or sound alarm signal will be given, waiting for the user to handle it.
2. BIOS startup boot phase
After the self-test is passed, each boot device is searched in order. The first device with a boot program is the boot target. equipment used. Generally, computers are entered into the BIOS by pressing the "F2" or "Del" key, where we can adjust the startup sequence of the hard disk.
After finding the first device with a boot program, the BIOS will find the MBR in the device and read the Bootloader
3.GRUP boot phase
At this time You can see our Centos system, but generally no operation is required, and the system will start automatically. In fact, we can also manually start the system ourselves
3.1 Manually start the system through the grub command line interface:
grub> root (hd#,#) grub> kernel /vmlinuz-VERSION-RELEASE ro root=/dev/DEVICE grub> initrd /initramfs-VERSION-RELEASE.img grub> boot
3.2 grub command line interface:
e: 编辑模式,用于编辑菜单; c: 命令模式,交互式接口; help: 获取帮助列表 help KEYWORD: 详细帮助信息 find (hd#,#)/PATH/TO/SOMEFILE: root (hd#,#) 设定grup的根设备 kernel /PATH/TO/KERNEL_FILE: 设定本次启动时用到的内核文件;额外还可以添加许多内核支持使用的cmdline参数; 例如:init=/path/to/init, selinux=0 initrd /PATH/TO/INITRAMFS_FILE: 设定为选定的内核提供额外文件的ramdisk; boot: 引导启动选定的内核;
3.3 Configuration file: /boot/grub/grub.conf
Configuration items:
default=#: 设定默认启动的菜单项;落单项(title)编号从0开始;
timeout=#:指定菜单项等待选项选择的时长;
splashimage=(hd#,#)/PATH/TO/XPM_PIC_FILE:指明菜单背景图片文件路径;
hiddenmenu:隐藏菜单;
password [--md5] STRING: 菜单编辑认证;
title TITLE:定义菜单项“标题”, 可出现多次;用来引导多个内核或者操作系统
root (hd#,#):grub查找stage2及kernel文件所在设备分区;为grub的“根”;
kernel /PATH/TO/VMLINUZ_FILE [PARAMETERS]:启动的内核
initrd /PATH/TO/INITRAMFS_FILE: 内核匹配的ramfs文件;
password [--md5] STRING: 启动选定的内核或操作系统时进行认证4. Loading the kernel phase
The kernel will itself Initialization:
Detect all identifiable hardware devices;
Load hardware drivers; (The driver may be loaded with the help of ramdisk)
Mount in read-only mode Root file system;
Run the first application in user space: /sbin/init
5.init initialization phase
The kernel is loaded , will run the init program. After the init process starts up, the control of system startup is transferred to the init process
/sbin/init process is the parent process of all processes. When init starts up, it will first read the configuration file /etc/inittab, perform the following work:
1.执行系统初始化脚本(/etc/rc.d/rc.sysinit),对系统进行基本的配置,以读写方式挂载根文件系统及其它文件系统,到此系统基本算运行起来了,后面需要进行运行级别的确定及相应服务的启动; 2.确定启动后进入的运行级别; 3.执行/etc/rc.d/rc,该文件定义了服务启动的顺序是先K后S,而具体的每个运行级别的服务状态是放在/etc/rc.d/rcn.d(n=0~6)目录下,所有的文件均链接至/etc/init.d下的相应文件。 4.有关key sequence的设置 5.有关UPS的脚本定义 6.启动虚拟终端/sbin/mingetty 7.在运行级别5上运行X
Configuration file: /etc/inittab
Each line defines an action and its corresponding process
id:runlevels:action:process id:一个任务的标识符; runlevels:在哪些级别启动此任务;#,###,可以为空,表示所有级别; action:在什么条件下启动此任务; process:任务;(脚本或程序)
action: wait:等待切换至此任务所在的级别时执行一次; respawn:一旦此任务终止,就自动重新启动之; initdefault:设定默认运行级别;此时,process省略; sysinit:设定系统初始化方式,此处一般为指定/etc/rc.d/rc.sysinit脚本;
K*: The service to be stopped; K##*, priority, the smaller the number, the priority is to shut down; the dependent services are shut down first, and then the dependent ones are shut down;
S*: The service to be started; S##*, priority, the smaller the number, the priority to start; the dependent service is started first, and the dependent service is started last;
chkconfig command: control /etc/init .d/The startup or shutdown status of each service script at each level;
查看:chkconfig --list [name] 添加:chkconfig --add name 删除:chkconfig --del name
Modify the specified link type:
chkconfig [--level LEVELS] name <on|off|reset> --level LEVELS:指定要控制的级别;默认为2345; init命令: 级别切换:init # 级别查看:who -r
Related references: centOS Tutorial
The above is the detailed content of What is the CentOS system startup process?. For more information, please follow other related articles on the PHP Chinese website!
CentOS: Exploring the AlternativesApr 15, 2025 am 12:03 AMAlternatives to CentOS include UbuntuServer, Debian, Fedora, RockyLinux, and AlmaLinux. 1) UbuntuServer is suitable for basic operations, such as updating software packages and configuring the network. 2) Debian is suitable for advanced usage, such as using LXC to manage containers. 3) RockyLinux can optimize performance by adjusting kernel parameters.
Centos shutdown command lineApr 14, 2025 pm 09:12 PMThe CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.
Difference between centos and ubuntuApr 14, 2025 pm 09:09 PMThe key differences between CentOS and Ubuntu are: origin (CentOS originates from Red Hat, for enterprises; Ubuntu originates from Debian, for individuals), package management (CentOS uses yum, focusing on stability; Ubuntu uses apt, for high update frequency), support cycle (CentOS provides 10 years of support, Ubuntu provides 5 years of LTS support), community support (CentOS focuses on stability, Ubuntu provides a wide range of tutorials and documents), uses (CentOS is biased towards servers, Ubuntu is suitable for servers and desktops), other differences include installation simplicity (CentOS is thin)
Centos configuration IP addressApr 14, 2025 pm 09:06 PMSteps to configure IP address in CentOS: View the current network configuration: ip addr Edit the network configuration file: sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0 Change IP address: Edit IPADDR= Line changes the subnet mask and gateway (optional): Edit NETMASK= and GATEWAY= Lines Restart the network service: sudo systemctl restart network verification IP address: ip addr
How to install centosApr 14, 2025 pm 09:03 PMCentOS installation steps: Download the ISO image and burn bootable media; boot and select the installation source; select the language and keyboard layout; configure the network; partition the hard disk; set the system clock; create the root user; select the software package; start the installation; restart and boot from the hard disk after the installation is completed.
Centos8 restarts sshApr 14, 2025 pm 09:00 PMThe command to restart the SSH service is: systemctl restart sshd. Detailed steps: 1. Access the terminal and connect to the server; 2. Enter the command: systemctl restart sshd; 3. Verify the service status: systemctl status sshd.
How to restart the network in centos8Apr 14, 2025 pm 08:57 PMRestarting the network in CentOS 8 requires the following steps: Stop the network service (NetworkManager) and reload the network module (r8169), start the network service (NetworkManager) and check the network status (by ping 8.8.8.8)
Restart centos7 commandApr 14, 2025 pm 08:54 PMReboot command is available to restart CentOS 7. The steps are as follows: Open the terminal window and enter the reboot command. Confirm the restart prompt. The system will restart and the boot menu will appear during this period. After the restart is complete, log in with the credentials.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function






