SYSTEMD Initialization Process
Linux operating system start-up process starts from the BIOS → enter "Boot Loader" → load kernel → kernel initialization → start the initialization process , the initialization process as the first process of the system, it needs to complete the relevant initialization work, to provide users with the appropriate working environment.
Red Hat RHEL7 systems have replaced the familiar initialization process system V initand formally adopted the new initialization process SYSTEMD. The initialization process SYSTEMD uses the concurrency boot mechanism, so the boot speed has been improved a little. Although Systemd has shown an advantage, there have been calls for resistance:
Slot 1: Lennart Poettering, the author, worked for Red Hat, making fans of other systems uncomfortable.
The 2:SYSTEMD can only run under the Linux system, abandoning BSD users.
Slot 3: Take over the work of services such as SYSLOGD, Udev, Cgroup and so on, no longer willing to do only the initialization process.
Spit 4: Use SYSTEMD after the RHEL7 system changes too large, reference documentation is not much, embarrassed us ah!
No matter how the groove, since the Red Hat RHEL7 system chose systemd, the original inittab will no longer work, there is no "runlevel" concept, Linux system startup to do a lot of initialization work-such as Mount file system and swap partition, Start all kinds of process services and so on, these can be seen as a unit, the analysis of the NFS service unit configuration file it:
[[email protected] ~]# cat/etc/systemd/system/nfs.target.wants/nfs-lock.service[Unit]Description=nfs file Locking service.//indicates that the Rpcbind service must already be running before the NFS service is started. Requires=rpcbind.service Network.targetafter=network.target Named.service rpcbind.servicebefore= Remote-fs-pre.target[Service]type=forkingstandarderror=syslog+consoleenvironmentfile=-/etc/sysconfig/ nfs//commands to be executed before starting the NFS service: EXECSTARTPRE=/USR/LIBEXEC/NFS-UTILS/SCRIPTS/NFS-LOCK.PRECONFIG//start NFS Service specific command syntax: execstart= /SBIN/RPC.STATD $STATDARG # Make sure LOCKD ' s ports is resetexecstoppost=-/sbin/sysctl-w fs.nfs.nlm_tcpport=0 Fs.nfs.nlm_udpport=0[Install]Wantedby=nfs.target
As mentioned earlier, in the Red Hat RHEL7 system, systemd uses " target" instead of the " runlevel " concept.
| Sysvinit 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 |
Modify the default RunLevel to "multi-user, no graphics mode":
[root@linuxprobe ~]# ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/ Default.target
Modify the default run level to "graphical mode":
[root@linuxprobe ~]# Ln-sf/lib/systemd/system/graphical.target/etc/systemd/system/default.target
It may be frustrating for readers who have studied Red Hat RHEL6 systems or have been accustomed to using commands such as service and chkconfig to manage system services, because the command to manage services in Red Hat RHEL7 system is "systemctl", But using the same method, let's make a comparison.
Systemctl commands to manage the start, restart, stop, reload, and view status of a service:
| Sysvinit command (Red Hat RHEL6 system) |
Systemctl command (Red Hat RHEL7 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 |
Systemctl set the command to start, not start, and view the service startup status at all levels:
| Sysvinit command (Red Hat RHEL6 system) |
Systemctl command (Red Hat RHEL7 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-up |
| Chkconfig--list |
Systemctl List-unit-files--type=service |
viewing startup and disabling of services under various levels
|
SYSTEMD initialization process (RPM)