System
控制程序:systemctl,用于管理各种类型的systemd对象,他们称为单元
守护进程:在执行各种任务的后台等待或运行的进程,过程名以进程名+d显示
控制单元:
.service 服务单元
.socket套接字单元
.path 路径单元
/usr/lib/system/system/ 优先级低
/run/system/system/
/etc/system/system/ 优先级高 用户修改的配置文件
查看服务的状态:
Systemctl status sshd 查看服务状态
Systemctl start sshd 启动服务
Systemctl stop sshd 停止服务
Systemctl restart sshd 重启服务
Systemctl enable sshd 系统重启后自动启动服务
Systemctl disable sshd 禁止开机重新启动服务
Systemctl mask iptables #屏蔽iptables服务
Systemctl unmask iptables #启动iptables服务
Systemctl �Ctype=service
systemctl --type=target
systemctl --type=socket
systemctl status rngd.service Cl
systemctl list-units Ctype=service
systemctl list-unit-files Ctype=service
systemctl Cfailed Ctype=service
控制服务:
Systemctl start|stop|restart|reload unit
依赖单元:
[root@desktop0 system]# systemctl list-dependencies unit
[root@desktop0 system]# systemctl list-dependencies multi-user.target
multi-user.target
├─abrt-ccpp.service
├─abrt-oops.service
├─abrt-vmcore.service
├─abrt-xorg.service
├─abrtd.service
├─atd.service
├─auditd.service
├─avahi-daemon.service
[root@desktop0 system]# systemctl list-dependencies multi-user.target --reverse
multi-user.target
└─graphical.target
以下是依赖于basic.target才能启动的服务:
[root@desktop0 system]# systemctl list-dependencies basic.target --reverse
basic.target
├─abrt-ccpp.service
├─abrt-oops.service
├─abrt-vmcore.service
├─abrt-xorg.service
├─abrtd.service
get-default 取得当前的target
Set-default 设置默认的用户模式
Isolate 切换到后面接的模式
Graphical.target #图形界面依赖于多用户模式
Multi-user.target
获得当前默认的target:
[root@desktop0 ~]# systemctl get-default
multi-user.target
配置默认的启动模式:
[root@desktop0 ~]# systemctl set-defaultmulti-user.target
[root@desktop0 ~]# systemctl set-defaultgraphical.target
[root@desktop0 ~]# systemctl set-defaultgraphical.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/graphical.target''/etc/systemd/system/default.target'
[root@desktop0 ~]# systemctl set-defaultmulti-user.target
rm '/etc/systemd/system/default.target'
ln -s'/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
从字符模式进入到图形模式:startx
要安装的图形界面相关的组件:
#切换到图形或字符模式
Systemctl isolate graphical.target|multi-user.target
Systemctl list-dependencies [unit] [--reverse]