What is the CentOS system startup process?
#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!

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

CentOS will be shut down in 2024 because its upstream distribution, RHEL 8, has been shut down. This shutdown will affect the CentOS 8 system, preventing it from continuing to receive updates. Users should plan for migration, and recommended options include CentOS Stream, AlmaLinux, and Rocky Linux to keep the system safe and stable.

The 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.

The 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)

Backup and Recovery Policy of GitLab under CentOS System In order to ensure data security and recoverability, GitLab on CentOS provides a variety of backup methods. This article will introduce several common backup methods, configuration parameters and recovery processes in detail to help you establish a complete GitLab backup and recovery strategy. 1. Manual backup Use the gitlab-rakegitlab:backup:create command to execute manual backup. This command backs up key information such as GitLab repository, database, users, user groups, keys, and permissions. The default backup file is stored in the /var/opt/gitlab/backups directory. You can modify /etc/gitlab

Complete Guide to Checking HDFS Configuration in CentOS Systems This article will guide you how to effectively check the configuration and running status of HDFS on CentOS systems. The following steps will help you fully understand the setup and operation of HDFS. Verify Hadoop environment variable: First, make sure the Hadoop environment variable is set correctly. In the terminal, execute the following command to verify that Hadoop is installed and configured correctly: hadoopversion Check HDFS configuration file: The core configuration file of HDFS is located in the /etc/hadoop/conf/ directory, where core-site.xml and hdfs-site.xml are crucial. use

Steps 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

When configuring Hadoop Distributed File System (HDFS) on CentOS, the following key configuration files need to be modified: core-site.xml: fs.defaultFS: Specifies the default file system address of HDFS, such as hdfs://localhost:9000. hadoop.tmp.dir: Specifies the storage directory for Hadoop temporary files. hadoop.proxyuser.root.hosts and hadoop.proxyuser.ro
