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

The method of starting the server by linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article is about how linux starts the server. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

Linux starts the server: first load bios and read mbr;, then run a program and load the kernel before the operating system kernel runs; then the init process executes [rc.sysinit] and starts the kernel module; finally, it executes [/ etc/rc.d/rc.local] and enters the login state.

How linux starts the server:

Start the first step-- load BIOS

When you power on the computer, the computer will load BIOS information first. BIOS information is so important that it counts

The computer must find it at the beginning. This is because BIOS contains relevant information about CPU and device startup sequence letter.

Information, hard disk information, memory information, clock information, PnP features and so on. After that, the computer has something in mind.

I know which hardware device to read.

Start the second step-- read MBR

As we all know, the first sector of track 0 on the hard disk is called MBR, or Master Boot Record, or master.

Boot record, its size is 512 bytes, although the space is small, but it contains pre-boot information and partition table letters.

Interest.

When the system finds the MBR of the hard drive specified by BIOS, it copies it to the physical memory where the 0x7c00 address is located.

In fact, what is copied to physical memory is Boot Loader, and when it comes to your computer, that is lilo or grub

Yes.

Start the third step-- Boot Loader

Boot Loader is a piece of Mini Program that runs before the operating system kernel runs. Through this Mini Program, we can

To initialize the hardware device and establish a mapping map of the memory space, so as to bring the software and hardware environment of the system to an appropriate state.

In order to prepare everything for the final call to the operating system kernel.

There are several kinds of Boot Loader, among which Grub, Lilo and spfdisk are common Loader.

Let's take Grub as an example. After all, not many people use lilo and spfdisk.

The system reads the grub configuration information in memory (usually menu.lst or grub.lst) and according to this configuration information

Start a different operating system.

Start the fourth step-- 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

A prompt for "Uncompressing Linux" is usually output. When the kernel is unzipped, the screen output "OK"

Booting the kernel ".

The system places the extracted kernel in memory and calls the start_kernel () function to start a series of initialization functions.

Count and initialize various devices to complete the establishment of the Linux core environment. At this point, the Linux kernel has been established.

The program on Linux should work properly.

Start the fifth step-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 follows the

This file is used for initialization.

In fact, the main function of / etc/inittab file is to set the running level of Linux, which is set in the form of ":

Id:5:initdefault: ", which means that Linux needs to run on level 5. The running level of Linux is set as follows:

0: shutdown

1: single user mode

2: multi-user mode without network support

3: multi-user mode with network support

4: reserved, unused

5: multi-user mode with network support and X-Window support

6: reboot the system, that is, restart

Start step 6-- the init process executes rc.sysinit

After setting the running level, the first user-level file executed by the Linux system is the / etc/rc.d/rc.sysinit script.

Preface, it does a lot of work, including setting PATH, setting network configuration (/ etc/sysconfig/network), starting

Move the swap partition, set / proc, etc. If you are interested, you can check the rc.sysinit text in / etc/rc.d

Pieces.

Start step 7-start the kernel module

Specifically, the kernel module is loaded according to the / etc/modules.conf file or the file in the / etc/modules.d directory.

Start step 8-execute scripts at different run levels

Depending on the running level, the system will run the corresponding script from rc0.d to rc6.d to complete the corresponding initial

Change the work and start the corresponding service.

Start step 9-execute / etc/rc.d/rc.local

If you open this file, there is a sentence in it, after reading it, you will know the function of this command at a glance.

Rc.local is the place where Linux is left for users to personalize after all initialization work. You can set up what you want.

And the things that start up are put here.

Start step 10-execute the / bin/login program and enter the login state

Thank you for reading! So much for sharing the method of starting the server for linux. I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

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