1, the Linux operating system boot process
Start from BIOS → enter boot loader→ load system kernel → kernel to initialize → start initialization process.
Initialization process as the first process of Linux system, it needs to complete the relevant initialization work in Linux system, and provide the user with the appropriate working environment. The Red Hat Rhel 7 system has replaced the familiar initialization process service System V INIT, formally using the new SYSTEMD initialization process service. If the reader has previously studied Rhel 5 or Rhel 6 systems, it may not be used. The SYSTEMD initialization Process service adopts the concurrent startup mechanism, and the boot speed is improved. Although the SYSTEMD initialization process service has many new features and benefits, there are currently 4 slot points below.
- Slot 1:SYSTEMD Initialization Process Service developer Lennart Poettering, who works for Red Hat, makes fans of other systems uncomfortable.
- Slot 2:SYSTEMD Initialization Process service can only run on Linux systems and"discards" Unix system users.
- Slot 3:SYSTEMD takes over the work of services such as SYSLOGD, Udev, Cgroup, and is no longer willing to do only initialization process services.
- Slot 4: After using SYSTEMD to initialize the process service, the RHEL 7 system changes too much, and the relevant reference documents are not many, which makes users really embarrassed.
2. The difference between SYSTEMD and system V init and its role
In any case, the RHEL 7 system chooses SYSTEMD initialization process Service is already a established fact, so there is no "runlevel" concept, Linux system at startup to do a lot of initialization work, such as Mount file system and swap partition, start various process services, etc. , which can be seen as a single unit, the SYSTEMD uses the target to replace the concept of runlevel in System V init, as shown in table 1.
Table 1 Differences between SYSTEMD and system V init and their role
System V init Run level |
systemd Target Name |
Role |
0 |
Runlevel0.target, Poweroff.target |
Shutdown |
1 |
Runlevel1.target, Rescue.target |
Single-User mode |
2 |
Runlevel2.target, Multi-user.target |
Equivalent to Level 3 |
3 |
Runlevel3.target, Multi-user.target |
Multi-User Text interface |
4 |
Runlevel4.target, Multi-user.target |
Equivalent to Level 3 |
5 |
Runlevel5.target, Graphical.target |
Multi-User graphical interface |
6 |
Runlevel6.target, Reboot.target |
Restart |
Emergency |
Emergency.target |
Emergency shell |
If you want to modify the system's default run target to "multi-user, no graphics" mode, you can directly connect the multi-user mode target file to the/etc/systemd/system/directory using the LN command:
[[Email protected] ~] # ln-sf/lib/systemd/system/multi-user.target/etc/systemd/ system
3. Comparison between system V init command in Rhel 6 and Systemctl command in Rhel 7 system
If a reader has previously learned the Rhel 6 system, or has been accustomed to using service, chkconfig and other commands to manage system services, it is now more depressing because the SYSTEMCTL command is used to manage the service in the Rhel 7 system. The comparison of the system V init commands in the Rhel 6 systems with the SYSTEMCTL commands in the Rhel 7 system, as shown in table 2 and table 3, allows you to get an overview of them, which are often used in subsequent chapters.
Table 2 common commands for starting, restarting, stopping, overloading, viewing status of SYSTEMCTL management services
System V init command (RHEL 6 systems) |
systemctl Command (RHEL 7 System) |
Role |
Service Foo Start |
Systemctl Start Foo.service |
Start the service |
Service Foo Restart |
Systemctl Restart Foo.service |
Restart Service |
Service Foo Stop |
Systemctl Stop Foo.service |
Stop Service |
Service Foo Reload |
Systemctl Reload Foo.service |
Reload configuration file (does not terminate service) |
Service Foo Status |
Systemctl Status Foo.service |
View service Status |
Table 3 Systemctl set up the service boot, do not start, see the level of service startup status, and other common commands
System V init command (RHEL 6 systems) |
systemctl Command (RHEL 7 System) |
Role |
Chkconfig foo on |
Systemctl Enable Foo.service |
Boot auto Start |
Chkconfig foo off |
Systemctl Disable Foo.service |
Boot does not start automatically |
Chkconfig Foo |
Systemctl is-enabled Foo.service |
To see if a particular service is powered on and started automatically |
Chkconfig--list |
Systemctl List-unit-files--type=service |
viewing startup and disabling of services under various levels |
SYSTEMD initialization Process