【转】How do I change runlevels in RHEL 7?

博客围绕Red Hat Enterprise Linux 7系统展开,提出如何设置默认运行级别为3或5、如何设置默认启动目标为文本或图形模式等问题。指出在RHEL 7中systemd已取代sysVinit成为默认服务管理器,还给出了在systemd中设置默认运行级别/目标及动态更改运行级别的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/2142121

 SOLUTION 已验证 - 已更新 2017年十一月10日21:47 - 

English 

环境

  • 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 RunlevelSystemd TargetWhat does it do?
0runlevel0.target, poweroff.targetSystem halt/shutdown
1, s, singlerunlevel1.target, rescue.targetSingle-user mode
2, 4runlevel2.target, runlevel4.target, multi-user.targetUser-defined/Site-specific runlevels. By default, identical to 3.
3runlevel3.target, multi-user.targetMulti-user, non-graphical mode, text console only
5runlevel5.target, graphical.targetMulti-user, graphical mode
6runlevel6.target, reboot.targetReboot
emergencyemergency.targetEmergency mode

Changing runlevels/targets

  • To set a default runlevel/target in systemd, use the following syntax:

    Raw

    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:

    Raw

    ln -sf /lib/systemd/system/<desired>.target /etc/systemd/system/default.target
    
  • To change runlevels on the fly:

    Raw

    systemctl isolate [multi-user.target | graphical.target]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值