https://access.redhat.com/solutions/2142121
SOLUTION 已验证 - 已更新 2017年十一月10日21:47 -
环境
- Red Hat Enterprise Linux 7
问题
- How do I set the default runlevel to 3 in RHEL 7?
- How do I set the default boot target to text only?
- How do I set the default runlevel to 5 in RHEL 7?
- How do I boot to graphical mode by default in RHEL 7?
- How do i set the default boot target to graphical in RHEL 7?
决议
- Systemd has replaced sysVinit as the default service manager in RHEL 7. Some of the sysVinit commands have been symlinked to their RHEL 7 counterparts, however this will eventually be deprecated in favor of the standard systemd commands in the future.
SysVinit to systemd conversions
| Sysvinit Runlevel | Systemd Target | What does it do? |
|---|---|---|
| 0 | runlevel0.target, poweroff.target | System halt/shutdown |
| 1, s, single | runlevel1.target, rescue.target | Single-user mode |
| 2, 4 | runlevel2.target, runlevel4.target, multi-user.target | User-defined/Site-specific runlevels. By default, identical to 3. |
| 3 | runlevel3.target, multi-user.target | Multi-user, non-graphical mode, text console only |
| 5 | runlevel5.target, graphical.target | Multi-user, graphical mode |
| 6 | runlevel6.target, reboot.target | Reboot |
| emergency | emergency.target | Emergency mode |
Changing runlevels/targets
-
To set a default runlevel/target in systemd, use the following syntax:
systemctl set-default <desired>.target -
If the server is in rescue mode or in a chrooted environment, the default target can be set with the following command syntax:
ln -sf /lib/systemd/system/<desired>.target /etc/systemd/system/default.target -
To change runlevels on the fly:
systemctl isolate [multi-user.target | graphical.target]
RHEL 7中设置默认运行级别和启动目标
博客围绕Red Hat Enterprise Linux 7系统展开,提出如何设置默认运行级别为3或5、如何设置默认启动目标为文本或图形模式等问题。指出在RHEL 7中systemd已取代sysVinit成为默认服务管理器,还给出了在systemd中设置默认运行级别/目标及动态更改运行级别的方法。
4392

被折叠的 条评论
为什么被折叠?



