1.7 Systemd initialization process
Linux operating system boot process is such that from the BIOS to start, and then enter the Boot Loader, and then load the kernel, then the kernel is initialized, and finally start the initialization process. The initialization process as the first process of a Linux system, it needs to complete the Linux system initialization related work, to provide users with a suitable working environment. Red Hat RHEL 7 system has replaced the familiar initialization process service System V init, officially adopted the new systemd init process services. If you learn it is before or RHEL 6 RHEL 5 system, may be used to. systemd init process uses a concurrent service start mechanism, boot speed has been no small improvement. Although the systemd init process service has many new features and advantages, but is still below 4 slot points.
Trough point 1: systemd developer Lennart Poettering initialization process services worked at Red Hat, which makes the fans very unhappy other systems.
Trough point 2: systemd init process service only runs under Linux system, "abandoned" the UNIX system users.
Trough Point 3: systemd took over the work, such as syslogd, udev, cgroup and other services, is no longer willing to serve only the initialization process.
Trough point 4: use systemd init process service, 7 RHEL system changes too, but not much relevant reference documentation, so that users really difficult.
In any case, RHEL 7 system initialization process Select systemd service is already an established fact, and therefore there is no "run level" concept, Linux system at boot time to a lot of the initial work, such as mounting file systems and swap partitions, boot process all types of services, all of which can be seen as a one unit (unit), systemd with a target (target) instead of the concept of System V init run levels, the difference between the two as shown in table 1-3.
Table systemd difference with System V init and the role of 1-3
System V init run levels | systemd target name | effect |
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 | Graphical multi-user interface |
6 | runlevel6.target, reboot.target | Restart |
emergency | emergency.target | Emergency Shell |
If you want the system default run target was revised to "multi-user, no graphics" mode, can be directly connected with the ln command to multi-user mode object files to / etc / systemd / system / directory:
[root@linuxprobe ~]# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
If readers had to learn before RHEL 6 system, or have become accustomed to using the service, chkconfig command to manage the system and other services, it is now more depressed, because the system is to use RHEL 7 systemctl commands to manage the service. Table 1-4 and Table 1-56 Comparative RHEL system shown in System V init commands. 7 RHEL system systemctl commands, you may want to look substantially, often used in the subsequent sections thereof.
Table 1-4 systemctl management services start, restart, stop, reload, view the status of other commonly used commands
System V init command (RHEL 6 system) | systemctl command (RHEL 7 system) | effect |
service foo start | systemctl start foo.service | Start Service |
service foo restart | systemctl restart foo.service | Restart Service |
service foo stop | systemctl stop foo.service | 停止服务 |
service foo reload | systemctl reload foo.service | 重新加载配置文件(不终止服务) |
service foo status | systemctl status foo.service | 查看服务状态 |
表1-5 systemctl设置服务开机启动、不启动、查看各级别下服务启动状态等常用命令
System V init命令(RHEL 6系统) | systemctl命令(RHEL 7系统) | 作用 |
chkconfig foo on | systemctl enable foo.service | 开机自动启动 |
chkconfig foo off | systemctl disable foo.service | 开机不自动启动 |
chkconfig foo | systemctl is-enabled foo.service | 查看特定服务是否为开机自启动 |
chkconfig --list | systemctl list-unit-files --type=service | 查看各个级别下服务的启动与禁用情况 |