修改Red Hat 7.4系统运行级别

[root@localhost init.d]# vi /etc/inittab

# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /etc/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/.target /etc/systemd/system/default.target

id:3:initdefault

问题分析:其实从该文件中,我们便可以分析出来,就是说呢,红帽7使用链接来设置修改运行级别。可以从这几句话分析出来,如下:

#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To set a default target, run:
#
# ln -sf /lib/systemd/system/.target /etc/systemd/system/default.target


该文件也为我们提供了修改的方法,在最后一行,这么一看,大家就觉得恍然大悟了吧,下面我来进行设置。

解决方法:
首先以root用户把 /etc/systemd/system 下的 default.target 文件删除:

#rm -f /etc/systemd/system/default.tareget

之后便可以进行设置:

#ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target

#ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target


之后reboot重启生效,亲测可行。

你可能感兴趣的:(我的收藏)