In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the process of starting the CentOS system". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what is the process of starting the CentOS system"?
When we press the boot button, do we know the secret behind the system? Here, I'll take you to explore the secret behind booting the linux system.
1. Power-on self-test
After the motherboard is connected to the power supply, the system will first check each internal equipment by the POST program. If errors are found in the self-test, they will be dealt with in two cases: for serious faults (fatal faults), the machine will be stopped, because various initialization operations have not yet been completed, no hints or signals can be given; for non-serious faults, prompt or sound alarm signals will be given, waiting for users to deal with.
2.BIOS boot phase
After passing the self-test, look for each boot device in order, and the first device with a boot program is the device to be used for this startup. Generally, the computer presses the "F2" or "Del" keys to enter the BIOS, in which we can adjust the boot order of the hard disk.
After finding the first device with a bootstrap program, BIOS finds the MBR in the device and reads the Bootloader in it
3.GRUP boot phase
At this time you can see our Centos system, but generally do not need to operate, will automatically start the system. In fact, we can also start the system manually.
3.1 manually start the system on 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 Command line interface of grub:
E: edit mode for editing menu
C: command mode, interactive interface
Help: get a list of help
Help KEYWORD: detailed help
Find (hd#,#) / PATH/TO/SOMEFILE:
Root (hd#,#) sets the root device of grup
Kernel / PATH/TO/KERNEL_FILE: set the kernel file used for this startup; in addition, you can add many cmdline parameters that the kernel supports.
For example: init=/path/to/init, selinux=0
Initrd / PATH/TO/INITRAMFS_FILE: set the ramdisk to provide additional files for the selected kernel
Boot: boot the selected kernel
3.3Profiles: / boot/grub/grub.conf
Configuration items:
Default=#: sets the menu item to be launched by default; the title number starts from 0
Timeout=#: specifies the length of time for menu items to wait for options to be selected
Splashimage= (hd#,#) / PATH/TO/XPM_PIC_FILE: indicates the path of the menu background picture file
Hiddenmenu: hiding menus
Password [--md5] STRING: menu Editor Certification
Title TITLE: defines the "title" of menu items, which can appear multiple times; used to boot multiple kernels or operating systems
Root (hd#,#): grub finds the device partition where the stage2 and kernel files are located; is the "root" of grub
Kernel / PATH/TO/VMLINUZ_FILE [PARAMETERS]: boot kernel
Initrd / PATH/TO/INITRAMFS_FILE: kernel matching ramfs file
Password [--md5] STRING: authenticates when starting a selected kernel or operating system
4. Loading kernel phase
The kernel initializes itself:
Detect all recognizable hardware devices
Load hardware drivers; (it is possible to load drivers with ramdisk)
Mount the root file system read-only
Run the first application in user space: / sbin/init
5.init initialization phase
After the kernel is loaded, the init program will be run. After the init process starts, the control of system startup will be transferred to the init process.
The / sbin/init process is the parent of all processes, and when init is up, it first reads the configuration file / etc/inittab and does the following:
1. Execute the system initialization script (/ etc/rc.d/rc.sysinit), make the basic configuration of the system, and mount the root file system and other file systems in a read-write manner. After that, the system is basically running, and then the running level and the corresponding service startup are needed.
two。 Determine the level of operation entered after startup
3. Execute / etc/rc.d/rc, which defines that the order in which services are started is K followed by S, while the service status of each runlevel is placed in the / etc/rc.d/rcn.d (nasty 0running 6) directory, and all files are linked to the corresponding files under / etc/init.d.
4. About the settings of key sequence
5. Script definition for UPS
6. Start the virtual terminal / sbin/mingetty
7. Run X on runlevel 5
Configuration file: / etc/inittab
Each line defines an action and its corresponding process
Id:runlevels:action:process
Id: the identifier of a task
Runlevels: at which level to start this task; #, #, which can be empty, indicating all levels
Action: under what conditions to start this task
Process: task; (script or program)
Action:
Wait: execute once when waiting to switch to the level of this task
Respawn: once this task is terminated, restart it automatically
Initdefault: sets the default run level; at this point, process omits
Sysinit: sets the initialization mode of the system. The / etc/rc.d/rc.sysinit script is usually specified here.
Knights: the service to be stopped; the smaller the number, the more priority it is to shut down; the dependent service shuts down first, then the dependent service shuts down
Slots: the service to be started. The smaller the number, the more priority it is to start. The dependent service starts first, while the dependent service starts later.
Chkconfig command: controls / etc/init.d/ the startup or shutdown status of each service script at all levels
View: chkconfig-- list [name]
Add: chkconfig-- add name
Delete: chkconfig-- del name
Modify the specified link type:
Chkconfig [--level LEVELS] name
-- level LEVELS: specifies the level to control; default is 2345
Init command:
Level switching: init #
Level view: who-r
Note:
Normally, the last service S99local started is not linked to a script under / etc/init.d, but to a / etc/rc.d/rc.local (/ etc/rc.local) script; therefore, when a program that is inconvenient or does not need to be written as a service script expects to boot and run automatically, it can be placed directly in this script file.
At this point, I believe you have a deeper understanding of "what is the process of starting the CentOS system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.