Linux操作系统-CentOS7启动流程和服务管理
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.systemd
POST --> Boot Sequence --> Bootloader --> kernel + initramfs(initrd) --> rootfs --> /sbin/init /sbin/init在各版本是不同的:
CentOS 5 SysV init CentOS 6 Upstart CentOS 7 Systemd
什么是Systemd:
系统启动和服务器守护进程管理器,负责在系统启动或运行时,激活系统资源,服务器进程和其它进程
Systemd新特性 系统引导时实现服务并行启动 按需启动守护进程 自动化的服务依赖关系管理 同时采用socket式与D-Bus总线式激活服务 系统状态快照 核心概念:unit unit表示不同类型的systemd对象,通过配置文件进行标识和配置;文件中主要包含了系统服务、监听socket、保存的系统快照以及其它与init相关的信息
配置文件: /usr/lib/systemd/system:
每个服务最主要的启动脚本设置,类似于之前的/etc/init.d/ /run/systemd/system:
系统执行过程中所产生的服务脚本,比上面目录优先运行 /etc/systemd/system:
管理员建立的执行脚本,类似于/etc/rcN.d/Sxx的功能,比上面目录优先运行
1>.systemd管理瞬态服务(即替代CentOS 6.x系列的非独立服务xinetd管理程序)
[root@node101.yinzhengjie.org.cn ~]# yum -y install telnet-server #注意,CentOS 7.x版本安装telnet server服务时并不会安装xinetd服务,原因就是xinetd有了替代角色,那就是systemd程序。 Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.tuna.tsinghua.edu.cn * updates: mirror.jdcloud.com Resolving Dependencies --> Running transaction check ---> Package telnet-server.x86_64 1:0.17-64.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================================================================================ Package Arch Version Repository Size ================================================================================================================================================ Installing: telnet-server x86_64 1:0.17-64.el7 base 41 k Transaction Summary ================================================================================================================================================ Install 1 Package Total download size: 41 k Installed size: 55 k Downloading packages: telnet-server-0.17-64.el7.x86_64.rpm | 41 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:telnet-server-0.17-64.el7.x86_64 1/1 Verifying : 1:telnet-server-0.17-64.el7.x86_64 1/1 Installed: telnet-server.x86_64 1:0.17-64.el7 Complete! [root@node101.yinzhengjie.org.cn ~]#