In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Centos7 launch process:
1.post (Power-On-Self-Test) Power-on self-Test
1 the main function is to detect whether various peripheral hardware devices exist and can run normally. This self-test function is realized by the BIOS (Basic Input/Output System) program solidified on the ROM (mainly represented as CMOS) chip on the motherboard; for example, BIOS will test whether the CPU, Memory and Igamo devices can function properly, and if it is a personal computer, it may also check the monitor. As soon as it is powered on, CPU will automatically load the BIOS program on the ROM chip, which is realized in this way. After the detection is completed, the hardware device is initialized.
2. Bootsequence (BIOS, select boot device)
1 the main function is to select the hardware device to start, and then you can read the bootloader in the MBR on this device. This step is implemented as follows: according to the boot sequence set in BIOS, BIOS scans each boot device in turn, and then the first device that is scanned to have a boot program (bootloader) is treated as the boot device to boot.
3.bootloader (MBR)
There are many steps to implement this step. The previous BIOS reads and executes the bootloader in the MBR of the startup device, and the function of bootloader is to provide a menu to the user.
Let the user select the system to boot or a different kernel version, then load the kernel version selected by the user into a specific space in RAM, then decompress, expand it in RAM, and then transfer system control to the kernel.
Grub is a kind of bootloader, as far as grub is concerned, in order to break the restriction that only 446Bytes is used to store bootloader in MBR, so the implementation of this step is like this: grub is divided into three stages to load the kernel, which are: stage1, stage1.5 and stage2. Where:
Stage1: a pre-446Bytes stored in MBR to load the stage1.5 phase in order to identify and drive the file system of the partition where stage2 (or / boot) resides
Stage1.5: the sector stored behind the MBR, which loads the file system driver of the partition where the stage2 resides, so that the bootloader in the stage1 can recognize the file system of the partition where the stage2 resides.
Stage2: stored on top of the disk partition, specifically under the / boot/grub directory, mainly used to load kernel files (vmlinuz-VERSION-RELEASE) and ramdisk as a temporary root file system (initrd-VERSION-RELEASE.img or initramfs-VERSION-RELEASE.img).
Summary: if you want to start a hard disk device, first of all, our hardware platform motherboard BIOS must be able to identify the hard disk, and then BIOS can load the bootloader in the hard disk, and bootloader itself can directly identify the hard disk device on the current host. However, being able to identify a hard disk device does not mean that it can identify the file system in the hard disk device, because the file system is an additional layer of software-organized file structure, so to dock a file system, there must be a corresponding driver that can identify and understand this file system, which is called a file system driver. Stage1.5 provides the file system driver to grub so that stage1 can access stage2 and the partition where the kernel is located (/ boot).
Note: the file paths of kernel and initramfs both start with the "root" of grub and are stored on the partition where stage2 is located.
It should be noted that stage2, kernel, and ramdisk files are usually placed on a basic disk partition, because grub cannot drive complex logic devices such as lvm, advanced soft raid, etc., unless a complex driver interface is provided, otherwise, if stage2 and kernel files are stored on complex logic devices such as lvm, they will not be recognized by stage1, let alone loaded!
4.kernel initialization
After gaining control of the system, Kerenl first initializes itself, and the main functions of initialization are:
(1) detect all recognizable hardware devices
Bootloader handing over control of the system to the kernel is like the post-dynasty overthrowing the previous dynasty. After the ruler (kernel) is in power, first check what is left by the previous dynasty, such as what territory, manpower, financial resources, troops are available, and so on.
(2) load the hardware driver, that is, load the driver of the device where the real root file system is located (possibly with the help of ramdisk)
This is like the ruler (core), after knowing the human and financial resources at the bottom, begins to include the manpower that can be "for my use" under his command, at his own command, rather than killing him.
(3) Mount the root file system read-only
If there is a temporary file system with the help of ramdisk (virtual root), a root switch is performed after this step; otherwise, no root switch is performed.
(4) run the first application in user space: systemd.
At this point, the startup process of the kernel space is over, and then the user space completes the subsequent system startup process.
5.init manages the user space service process
Systemd executes the default target configuration, configuration file / etc/systemd/system/default.targetsystemd executes sysinit.target initialization system and basic.target preparation operating system systemd starts native and server services under multi-user.target systemd executes / etc/rc.d/rc.localSystemd executes getty.target under multi-user.target and login services systemd executes the services required by graphical
Write the systemd configuration file of Nginx to realize the startup of nginx process.
Vim / lib/systemd/system/nginx.service [Unit] Description=nginx server After=network.target [Service] Type=forking ExecStart=/usr/sbin/nginx [Install] WantedBy=multi-user.target [root@localhost ~] # systemctl enable nginx.service
Summary
The above is the Centos7 startup process introduced by the editor and the Nginx startup configuration in Systemd. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to the website!
If you think this article is helpful to you, you are welcome to reprint it, please indicate the source, thank you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.