Linux - starting point of knowledge management

Start the process - run level

1, the system run level
 
0 - Off
1 - Single-user mode, it is conceivable for the windows security model, mainly for system repair
2 - Incomplete command-line mode, without NFS service
3 - full command-line mode is the standard the character-based interface
4 - system reserved
5 - GUI mode
6 - restart 2, run the command level 
# command to view the run level: runlevel
# command to change the operating sectors: init run levels
instance: View the current system run level
[root @ 192 /] # runlevel
N 3
, said: which system is changed from the level to which level, such as "5,3" indicates that the system is from a graphical interface, switch to the command line mode. If N, the empty, enter a boot on three levels. 
Example:? If you want a character from the interface, enter the graphical interface, how to operate
[root @ 192 /] # init
Note: When switching the graphical interface, you may be prompted to enter a password! 3, the system default run level configuration file / etc / inittab 
[/ etc / inittab file contents · The main part]
--------------------------- -------------------------------------------------- -------------------------------------------------- -









. # The Default runlevel at The runlevels Used are: 
# 0 - the HALT (the Do the NOT the SET initdefault to the this) 
# 1 - Single the User the MODE
# 2 - Multiuser, the without NFS (at The Same, AS 3, IF you do not have have Networking) 
# 3 - Full Multiuser the MODE 
# 4 - unused 
# 5 - X11 
# 6 - reboot (the Do the NOT the SET initdefault to the this) 
# 
the above mentioned id: 3 : initdefault: 
----------------------------------------------- -------------------------------------------------- -------------------------------- 

Note: 0 and 6 two levels are not set to start running constituency!

Start the process - to start the process

Usually, Linux boot process is this: boot, this time, BIOS chip will POST, after the self-test is complete, load the MBR, which is what we say in the master boot record, master boot records to be kept in our start boot program, in Linux, start a program, called GRUB, GRUB stored in the MBR, the master boot system is activated, the next step guide. 

This time, there is a branch, to be selected. If the server has a Linux, start a program, that is, GRUB will directly load the kernel, then the next step is to start; if my computer not only have Linux systems, as well as Windows systems, or, there are two different versions of Linux, at this time, the state will enter a multi-boot system, choose to go in there and give you a list that lets you select. What the election system, which system will load the kernel, start, and then to the next step. 

Note that in Linux, when loading the kernel, taking into account performance, the rate will be compressed, so, after the election, the system will be among the first in memory, decompress. After the extraction is complete, the kernel will then conduct a self-test (self-test twice, BIOS once, once the kernel). Linux is the kernel of self-confidence, it will self-test process, recorded in dmsg command. 

After the self-test is complete, the kernel will load the driver. Our Linux is the case, we installed a virtual machine when An End Linux, all kernel directly drive, then, we can directly use. In Windows, if you need a driver, was installed manually; however, Linux is not, Linux virtual machine and install a real machine is the same, as long as you install the kernel, because all the drivers are installed in the kernel, the kernel will pass server hardware, which drivers need to see in the end, then, automatically loaded, so the drive after the kernel is installed, you can directly use.

However, there is a problem that if the drive system are installed in the kernel, the kernel of that pressure, is it great? How to do that? Linux solution is the common driver is installed in the kernel, the unusual as a function of the drive module, which is to write a driver program stored in the hard disk, the lib directory under the root, which is the location to save libraries. When I need to go to this directory and obtain kernel, you can. Thus, to ensure that the core pressure is not too great. 

So on to say, Linux does not need to separately install the driver, the kernel is loaded, you can use without additional installation. Only one case (for example, hardware is too new, and when hardware issue, the kernel already exist), you need to manually install that Linux kernel does not have this. 

Logically, lib at the core self-test is completed, it will go to the root of the drive down to read, read out, can be loaded, but here there is a relatively large paradox! 

If our hard disk IDE interface, IDE interface is driven directly in memory, it recognizes your hard drive, you can take directly related services from lib. However, we are now absolutely most computers, our hard drives are SATA interface, or SCASI the interface, SATA interface hard disk, Linux will believe that it is not necessary for me, so, it is as a module, add this to the lib directory . 

That a problem? Yes, What do you mean? I'm the kernel, you must go to the lib directory, read SATA drive, I can recognize the hard drive, but, since I did not recognize the hard drive, how do I load it drive? Drive SATA interface , is placed under the lib directory of the hard drive, but I do not have this driver, I can not read the hard drive. Equivalent, I have a cupboard, in order to take the closet thing, but the key in the cupboard, I had to get the key, to get this thing right now, I do not have the key to open the door, let alone take inside things. 

How to do?

If I really want to open this door, you have to go to unlock the company. Available for Linux, but also take a similar approach, which in our boot partition, among them, a initranfs file system, the file system simulates a fundamental similarity with the hard disk structure, and then the kernel to load the similar structure through which the basic common drive, loaded into the kernel. This is obtained by SATA drives, not to and from the transfer lib, but from the analog system to retrieval. Kernel is loaded, loaded it, in order to establish the simulation directory to load the real hard disk partitions, to read the rest of the other drivers, that is, Linux system to do a fake root directory, this fake root directory, preserved on the hard drive must be, this guy is loaded into the kernel, the kernel can be called a real drive, the equivalent, you get a simulation of the key, opened the cupboard, to take something. 

initranfs this file, stored in the / boot directory, then there is a problem, initranfs on / boot, then / boot is also on the hard disk, since the kernel can not load lib at the root, of course, it should not be loaded / boot up? 

it should be noted, / boot is not loaded by the kernel, but loaded by the boot loader, it has been read out in advance. Because the boot directory is the boot partition, so the boot loader, is the default boot partition can be identified. 

With virtual drive directory, with the equivalent of open / lib directory of the key, so he took to the associated drive, read the real directory on your hard drive, have a real system hard drive, you can read the real hard drive. It can read inside the real root of the simulation "key documents" the mission is over.

Now is the real root of the system to read the hard disk. After reading it, we retrieved / sbin / init directory, init is the first system boot process, after which it was born, was derived from other processes, can subsequent start back, then, will first call the call / etc /init/rcS.conf profile, has two main functions, first call /etc/rc.d/rc.sysinit, and, initialized by /etc/rc.d/rc.sysinit Linux system configuration file; then and then call the / etc / inittab, by the / etc inittab configuration file to determine / default run level of the system. /etc/init/rcS.conf initialization of the system are initialized what it, as follows: 
1, the network environment 
2, mount a device 
3, Plymouth startup screen (the past substituted RHGB) 
. 4, determines whether to start the SELinux 
. 5 , the start up process welcome screen 
6, initializes the hardware 
7, user-defined modules loaded 
8, kernel configuration parameters 
9, set the host name 
10, a synchronous memory 
11, device mapper and associated initialization 
12, initialization software disk array (the RAID) 
13 is, file system initialization LVM function 
14, check disk file system (the fsck) 
15, set disk quotas (quota) 
16, may be remounted in a read-write mode system disk 
17, updated quota (optional) 
18, start system pseudo-random number generator 
19, the machine configuration (non-essential) 
20, clear temporary files among the boot process


21, create a directory ICE 
22 to start the swap partition (swap) 
23, the boot information is written to / var / log / dmsg file 

after initialization is complete, it will call the / etc / inittab file to determine the system boot interface is a character interface or graphical interface, followed by the incoming operation level to /etc/init/rc.conf file, then call /etc/rc.d/rc file, then run level, call the / etc / rc [0-6]. d file (if it is character interface, call /etc/rc3.d file; if it is a graphical interface, call /etc/rc5.d file). Finally it, in accordance with the appropriate priority startup and shutdown scripts, restart and shutdown procedures in /etc/rc.d/rc.local. 

Executing the above, it is to "login screen", and this time, we enter a user name and password, log into the program starts is completed!
Call /etc/rc.d/rc file
 
run level after passing parameters /etc/rc.d/rc the script from the script in a different run level, start /etc/rc[0-6].d directory the corresponding program. 

1, / etc / rc3.d / kbeginning of the file (digital ??), will turn off in numerical order (k i.e., the kill)
2, / etc / the rc3.d / S ?? beginning of the file (? ? digital), will in turn starts in numerical order (S ie start)

Boot loader - Grub configuration file

1, grub partitions represent

2, grub configuration file
 
vi the /boot/grub/grub.conf

# default = 0 default boot the first system (if there is more than one system, there will be options 0 and 1)
# timeout = 5 waiting time, the default is 5 s
# splashimge = (hd0,0) /grub/splash.xpm.gz here is to specify the background image when grub starts saving position
# hiddenmenu hidden menu (up and down buttons to move about, will be able to see the menu)


/ the boot / grub / grub.conf file contents

Note: There are several system configuration, there are several portions of the following

Notes on the above this content: 
title CentOS (2.6.32-279.el6.x86_64) 
# title is CentOS (2.6.32-279.el6.x86_64) 

        root (hd0, 4) 
# refers to save the partition boot program 

        kernel /boot/vmlinuz-2.6.32-279.el6.x86_64 ro root = UUID = 7e2f23ae -71f2-4838-86fb-8f134b98e069 rd_NO_LUKS KEYBOARDTYPE = pc KEYTABLE = us rd_NO_MD crashkernel = auto LANG = zh_CN.UTF-8 rd_NO_LVM rd_NO_DM rhgb quiet (kernel loads of options) 
# option of a kernel to load 
        the initrd /boot/initramfs-2.6.32-279.el6.x86_64.img 
# specifies the location of initramfs memory file system image file resides 

initramfs-2.6.32- 279.el6.x86_64.img file location

If you are in your server where both want to install a Linux system, and want to install a Windows system, you might do is to install windows, then install Linux. Because the Windows boot loader will not recognize Linux. If you are the first Linux installation, then, Windows will overwrite the boot loader for Linux Grub, thus, leading Linux can not start. If you first install Windows, installed after Linux, Linux will recognize the grub for Windows, Linux's grub will cover Windows, and Windows will start at the same time added to the grub Lane, /boot/grub/grub.conf this file, it will more That is four lines two sets of configuration. This time, you can choose which one to start. 

The real work, the server usually only install a system to ensure the stability of the system, normal operation, therefore, not Amdo system!
Published 59 original articles · won praise 2 · Views 5562

Guess you like

Origin blog.csdn.net/LDR1109/article/details/103882049