In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The linux system starts to detect hardware information from BIOS = "start the bootstrap program. Read MBR (the first sector of track 0 on the disk), that is, Master Boot Record, the master boot record. MBR records pre-boot information and partition table information. Then copy the grub (function: set the location of the kernel image on the disk partition) to memory. Prepare to start the kernel. = "load kernel. Kernel initialization produces an init process with PID 1.
* you need to pay attention to installing win+linux dual system here. Install w and then linux. Because the bootstrap of win will override the bootstrap of other systems. The grub of linux is missing and cannot be started *
Because the kernel is useless, we need a system that can define, manage and control the behavior of the init process, and be responsible for organizing and running the initialization work, so as to make the system enter a user-set running mode, that is, the init system.
Init (short for English: initialization) is a program used to generate all other processes in unix and Unix-like systems. It exists as a daemon with a process number of 1. After the Linux system loads the Linux kernel at boot time, the Linux kernel loads the init program, and the init program completes the rest of the boot process.
The operation mode of init goes through sysvinit, upstart, systemd
The init operation mode of the early linux system is compatible with init operation mode under UNIX system V (a version of the Unix system).
The operation mode of init under System V:
System V init checks to see if there is a 'initdefault' entry in the / etc/inittab' file. This tells init whether the system has a default run. System V init describes 8 states. 0-6 and S or S. Linux set 6 levels: # cat / etc/inittab
# Default runlevel. The runlevels used are:
# 0-halt (Do NOT set initdefault to this)
# 1-Single user mode
# 2-Multiuser, without NFS (The same as 3, if you do not have networking)
# 3-Full multiuser mode
# 4-unused
# 5-X11
# 6-reboot (Do NOT set initdefault to this)
Unix system v starts at level 3 by default. Most versions of linux servers default to level 3. The desktop version is generally 5. (graphical interface). How to view: $runlevel or $who-r.
The advantage of Sysvinit is that the concept is simple. Service developers only need to write start and stop scripts, the concept is very clear; when you add / remove service to a runlevel, you only need to perform some basic operations to create / delete soft connection files; these do not require additional knowledge or special definition syntax (both UpStart and Systemd require users to learn new languages that define system initialization behavior).
Second, another important advantage of sysvinit is the determined order of execution: scripts are executed in strict order according to the size of the startup numbers, with one execution completed and the next executed, which is very useful for error troubleshooting. UpStart and systemd support concurrent startup, so that no one can know for sure the specific startup sequence, and it is not easy to make mistakes.
In 2006, Ubuntu planned to use the system on laptops. The biggest dilemma is that sysvinit does not have enough hot-swappable support for mobile devices (devices for USB devices). So the event-based mechanism of upstart is developed. For example, after the USB disk is plugged into the USB interface, udev is notified by the kernel and discovers the device, which is a new event. When the UpStart senses the event, it triggers the corresponding waiting task, such as processing the mount point that exists in / etc/fstab. With this event-driven model, upstart perfectly solves the new problems caused by plug and play devices. UpStart uses an asynchronous way to start the system faster, start the service dynamically when new hardware is discovered, and stop the service dynamically when the hardware is unplugged. These characteristics make UpStart can be well used in desktop or portable systems to deal with the dynamic hardware plugging and unplugging features in these systems. But UPstart has not completely got rid of the runlevel mechanism. Only the runlevel mechanism is optimized accordingly on the basis of compatibility.
In order to reduce the system startup time, the goal of systemd is to start as few processes as possible, and to start as many processes in parallel as possible, thus reducing the dependence between startup processes. Unnecessary processes can only be started when they are needed. In addition, systemd has created a new management system. The previous concept of run level (runlevel) has been replaced by a new run target (target). The naming system of target is similar to "multi-user.target" and corresponds to the original run level 3 (runlevel 3). In centos7 due to the use of the new systemd management mechanism. The concept of runlevel is no longer used, so / etc/inittab is no longer used by the system.
The default target of systemd management system under centos7 is realized by soft link.
(due to layout problems, the inode value belongs to the main group and date is deleted)
[root@jf7 ~] # ll / etc/systemd/system/default.target
Lrwxrwxrwx. / etc/systemd/system/default.target-> / lib/systemd/system/multi-user.target
If you want to modify the run target. Just delete the soft link. Soft link to the new running target.
# rm-rf / etc/systemd/system/default.target
# ln-s / lib/systemd/system/multi-user.target / etc/systemd/system/default.target
Let's take a look at the centos7 / etc/inittab file.
$cat / etc/inittab
# inittab is no longer used when using systemd.
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
# Ctrl-Alt-Delete is handled by / usr/lib/systemd/system/ctrl-alt-del.target
# systemd uses' targets' instead of runlevels. By default, there are two main target
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
# To view current default target, run:
# systemctl get-default
# To set a default target, run:
# systemctl set-default TARGET.target
The location of the new target is clearly defined: / usr/lib/systemd/system/ctrl-alt-del.target
Also check: (due to layout problems, the inode value belongs to the main group and date is deleted)
# ll / usr/lib/systemd/system/runlevel*
Lrwxrwxrwx / usr/lib/systemd/system/runlevel0.target-> poweroff.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel1.target-> rescue.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel2.target-> multi-user.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel3.target-> multi-user.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel4.target-> multi-user.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel5.target-> graphical.target
Lrwxrwxrwx / usr/lib/systemd/system/runlevel6.target-> reboot.target
In addition, the systemd management system also introduces the command line tool systemctl. Systemctl can be thought of as service and chkconfig
It has to be a combination. But don't worry. The service command can still be used under centos7, but it redirects all commands to the new systemctl tool.
A few examples:
(sysvint)
# service network start | stop | status
# chkconfig httpd on
(systemclt)
# systemctl start | stop | status network.service
# systemctl enable httpd.service
At present, systemd is installed on the default init in Ubuntu 15.04and later versions.
After introducing the mainstream init system, continue to start the system. (processes with PID 1 before centos7 are generated by / sbin/init. Processes with PID 1 of centos7 are generated by / usr/lib/systemd/systemd.)
BIOS-mbr-grub-load kernel into memory-/ etc/inittab- / etc/rc.d/rc.sysinit-start kernel module / etc/modules.conf- start script rcx.d- execution / etc/rc.d/rc.local-/ bin/login at specified level
Although I mentioned many of the benefits of the new init system, the overall enterprise user base of centos7 is small. We still need to be proficient in launching the next version of centos7. It is convenient for future management. And centos7 is fully backward compatible at the command level.
Combed, boot start the process. You can have some small applications.
For example, mount a mobile device in / etc/rc.d/rc.local and add a personalized service to start. If, the change phase of that service can not be started, resulting in. Initiate blocking. Whether you can enter single-user mode first and comment out the service under the / etc/rc.d/rc.local file. To be tested and repaired after being turned on?
The most important thing is. After getting familiar with the boot. Can be based on the boot error message. Troubleshooting is a mistake made at that stage. Such as rebooting the system together. Check to see if / etc/inittab has runlevel6 mode set. Boot script error should not be a single user into the system troubleshooting. / etc/rc.d/rcx.d the following script, if necessary, the script that begins with S can be renamed K first. Recover after the system starts.
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.