Redhat boot starting process [Pick]

xiaoxiao2021-03-06  22

# 版权 告: 1999 Copyright Ols3 All Rights Reserved.

Reference for future reference OLS3 (Wolong Primary Three) # This lecture is for Tainan County 87 academic year advanced network management workshops with classes of students can save a copy for personal use # for future network management retains copyright of all time # forms: # Author. # 作 作 其 用, 作者 同.

Redhat boot starting process:

1. LILO acquires control.

When the PC starts, the first sector of the first Cylinder of the boot disk will be read, and then it will try to load the memory code and execute. These program code is LILO. I don't remember that when we installed, I chose to put lilo into MBR?!

2. Load KERNEL

Red Hat's kernel is placed in / boot, usually similar to VMLinuz-

2.0.34

-0.6, Vmlinuz-2.2.5-15

3. Kernel performs the first program / sbin / init

INIT will determine how different Run-Level should set the system according to the / etc / inittab this initialization table.

Red Hat's Run-level has the following 7 layers: (defined in / etc / inittab)

0 --- Halt: Shutdown Level

· 1 --- Single User Mode: Single mode, if you forget the root password, this is one of the ways of remedies.

· 2 --- MultiUser, WITHOUT NFS: Multi-person mode, but no NFS function, if there is no network function when installing, then Level 3 is the same.

· 3 --- Full MultiUser Mode: This is a scheduled Run-Level

· 4 - unused: This run-level is currently not defined.

· 5 --- x11: x windows used by Level

· 6 - Reboot: LEVEL used when rebooting

When the Linux system is turned on, the most important concept is this run-level, run-level can be said to be system stats of Linux, enter different system status according to different situations to perform different initialization actions.

In addition, although Linux combines the characteristics of System V and BSD, it is relatively close to System V, and this method has almost become a standard for Linux world. Because it is easy to use, function Powerful and elastic features.

Its directory archive structure is as follows:

/etc/rc.d contains:

Directory Script file

/etc/rc.d/init.d /etc/rc.d/rc0.d /etc/rc.d/rc1.d /etc/rc.d/rc2.d /etc/rc.d/rc3.d /etc/rc.d/rc4.d /etc/rc.d/rc5.d /etc/rc.d/rc6.d

RC rc.local rc.sysinit

Rc0.d is the directory of run-level 0 boots Script, RC3.D is Run-Level 3, and other push

However, Script in RC0.D ~ RC6.D is not independent, in fact, they are all Symbolic File, which is connected to the Script in /etc/rc.d/init.d.

For example, the list of files in the RC3.D directory is as follows:

Total 0

LRWXRWXRWX 1 root root 20 May 23 15:56 k15postgreSQL -> ../init.d/postgreSQL

LRWXRWXRWX 1 root root 17 May 23 15:56 k20rusersd -> ../init.d/rusersd

LRWXRWXRWX 1 root root 15 May 23 15:56 k20rwhod -> ../init.d/rwhodlrwrwrwxrwx 1 root root 16 May 23 15:56 k55routed -> ../init.d/routed

LRWXRWXRWX 1 root root 17 May 23 15:56 S01kerneld -> ../init.d/kerneld

LRWXRWXRWX 1 root root 17 May 23 15:56 S10Network -> ../init.d/network

LRWXRWXRWX 1 root root 15 May 23 15:56 S15NFSFS -> ../init.d/nfsfs

LRWXRWXRWX 1 root root 16 May 23 15:56 s20random -> ../init.d/random

LRWXRWXRWX 1 root root 16 May 23 15:56 s30syslog -> ../init.d/syslog

LRWXRWXRWX 1 Root Root 13 May 23 15:56 S40ATD -> ../init.d/atd

LRWXRWXRWX 1 root root 15 May 23 15:56 S40crond -> ../init.d/crond

LRWXRWXRWX 1 root root 17 May 23 15:56 S40portmap -> ../init.d/portmap

LRWXRWXRWX 1 root root 15 May 23 15:56 s40snmpd -> ../init.d/snmpd

LRWXRWXRWX 1 root root 16 May 23 15:56 s45pcmcia -> ../init.d/pcmcia

LRWXRWXRWX 1 root root 14 May 23 15:56 S50INET -> ../init.d/inet

LRWXRWXRWX 1 root root 15 May 23 15:56 s55named -> ../init.d/named

LRWXRWXRWX 1 root root 13 May 23 15:56 s60lpd -> ../init.d/lpd

LRWXRWXRWX 1 root root 18 May 23 15:56 s75keytable -> ../init.d/keytable

LRWXRWXRWX 1 root root 18 May 23 15:56 s80sendmail -> ../init.d/sendmail

LRWXRWXRWX 1 root root 13 May 23 15:56 s85gpm -> ../init.d/gpm

LRWXRWXRWX 1 root root 15 May 23 15:56 s85httpd -> ../init.d/httpd

LRWXRWXRWX 1 root root 15 May 23 15:56 s85ssound -> ../init.d/sound

LRWXRWXRWX 1 root root 13 May 23 15:56 s91smb -> ../init.d/smb

LRWXRWXRWX 1 root root 11 May 23 15:48 s99local -> ../rc.local

You can find that these Script files are not starting with S, which is started with K, and then connects to the two digits, and is connected to the related scripts files in the init.d directory.

In the beginning, it indicates that the start of the start, and the K starts, it is the meaning of Kill kill. 4. Init executions Script: /etc/rc.d/rc.sinit

Rc.sinit sets many system variables, such as:

· Set the path

· Set the network: read / etc / sysconfig / network to set Networking, Forward_IPv4, Hostname, DomainName, GateWary, GatewayDev (Eth0)

· Set NIS Domain Name

And many of the preparations required before running Run-Level, such as:

· Start Swapping

Checking root filesystems: Check ROOT file system

· Check system parameters (/ proc), set PNP

· Clear / etc / MTAB

· Mount root and / proc archive system

· Decide whether to use modules, load the module

· Check file systems (using fsck)

· Mount other archives system

· Set up Console Font

· Open quota

· Clear unnecessary files, such as LOCK, PID

· Set the clock

· Serial Port initialization

· Put the message via DMESG in / var / log / dmesg

5. INIT executes all Scripts in the preset Run-Level directory

Under normal circumstances, RC3.D is: Id: 3: INitDefault: Id: 3: INITDEFAULT: The Run-Level indicating the preset to be executed is Level 3. Therefore, the RC3.D just seen above. SXX and KXX are executed.

6. Finalin execution /etc/rc.d/rc.local this Script.

Rc.local will be executed after the Script of each run-level. You can add the action you want to process during booting in this Script.

7. After init, then execute the / bin / login program

The Login program will prompt the user to enter the account and password, then encode and confirm the correctness of the password, if the two meet, the initialization environment is initialized, and the control is handed over to the Shell.

8. Shell

Suppose the preset shell is BASH, then BASH will first look for / etc / profile, execute the instructions, then search for. Bash_profile, .bash_login, or .profile, execute one, then command prompt symbol The $ appears on the screen, waiting for you to enter the command.

At this point, the flow of the entire boot is completed.

转载请注明原文地址:https://www.9cbs.com/read-43090.html

New Post(0)