Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed explanation of the running level and boot process of linux under CentOS

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the detailed explanation of the running level and boot process of linux under CentOS". In the daily operation, I believe that many people have doubts about the running level and boot process of linux under CentOS. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts of "detailed explanation of running level and boot process of linux under CentOS". Next, please follow the editor to study!

1.linux run level:

1) 0: shutdown

2) 1: single user

3) 2: there is no network service in multi-user state

4) 3: network services are available in multi-user status

5) 4: the system is not in use and reserved for the user

6) 5: graphical interface

7) 6: system restart

Note: the commonly used runlevels are 3 and 5. To modify the number in the id:5:initdefault of the runlevel changeable file / etc/inittab.

two。 The solution to forgetting the root password:

When the machine starts, enter the grub boot program, press e, and then select the line with label= (usually the second line), then click an e, enter a 1, (that is, the running level is changed to 1), then enter, enter stand-alone mode, and then restart, you can modify the original configuration file.

3.linux boot process:

1) load BIOS, when you turn on the computer power, the computer will first load BIOS information, BIOS contains CPU-related information, device boot sequence information, hard disk information, memory information, PnP features and so on. So the computer knows which hardware device to read.

2) read MBR, as we all know, the first sector of track 0 of the disk is called MBR (Master Boot Record), that is, the master boot record, its size is 512 bytes, and it contains pre-boot information and partition table information. When the system finds the hard disk MBR specified by BIOS, it copies it to the physical memory where the 0X7c00 address is located. The content of memory is Boot Loader, and when it comes to your computer, it is lilo or grub.

3) Boot Loader: a piece of Mini Program before the operating system kernel runs. Usually in this section of Mini Program, we can initialize the hardware devices and establish a memory space mapping, so as to bring the software and hardware environment of the system to an appropriate state, so that we are ready for the final call to the operating system kernel. There are several kinds of Boot Loader, of which Grub,Lilo and spfdisk are the most commonly used. For example, grub, the system also reads the grub configuration information in memory (usually menu.lst, or grub.lst) and starts different operating systems according to this configuration information.

4) load the kernel: according to the path of the kernel image set by grub, the system reads the memory image and decompresses it. At this point, the screen usually outputs a prompt for "Uncompressing Linux". When the kernel is unzipped, the screen outputs "OK,booting the kernel". The system places the decompressed kernel in memory and calls the star_kernel () function to start a series of initialization functions and initialize various devices to complete the establishment of the linux core environment. At this point, the linux kernel has been set up, and linux-based programs should work properly.

5) the user layer init sets the running level according to the inittab file: after the kernel is loaded, the first program to run is / sbin/init, which reads the / etc/inittab file and initializes it according to this file. In fact, the main function of the / init/inittab file is to set the Linux running level, which is set in the form of ": id:5:initdefault:", which indicates that Linux needs to run on level 5. See 1 for the running level.

6) init process executes rc.sysinit: after setting the running level, the first user layer file executed by the linux system is the / etc/rc.d/rc.sysinit script program, which does a lot of work, including setting Path, setting network configuration (/ etc/sysconfig/network), starting swap partition, setting / proc, and so on.

7) start the kernel module: load the kernel module according to the / etc/modules.conf file or the file in the / etc/modules.d directory.

8) execute scripts with different running levels: according to the different running sectors, the system runs the corresponding scripts from rc0.d to rc6.d to complete the corresponding initialization work and start the corresponding services.

9) execution / etc/rc.d/rc.local:rc.local is the place where linux is left to the user for personalization after all initialization work. You can put what you want to set up and start up here.

10) execute the / bin/login program and enter the login state: at this time, the system has entered the time to wait for users to enter username and password, and you can log in to the system with your own account.

At this point, the study on the "detailed explanation of the running level and boot process of linux under CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report