CentOS七个启动级别和默认启动级别设置(init)
本文最后更新于 875 天前,其中的信息可能已经有所发展或是发生改变。

CentOS七个启动级别和默认启动级别设置(init)

手动输入命令会执行相关操作

init 0 运行级别0:系统停机状态,系统默认运行级别不能设为0,否则不能正常启动

init 1 运行级别1:单用户工作状态,root权限,用于系统维护,禁止远程登陆

init 2 运行级别2:多用户状态(没有NFS)

init 3 运行级别3:完全的多用户状态(有NFS),登陆后进入控制台命令行模式

init 4 运行级别4:系统未使用,保留

init 5 运行级别5:X11控制台,登陆后进入图形GUI模式

init 6 运行级别6:系统正常关闭并重启,默认运行级别不能设为6,否则不能正常启动

使用方法

init命令很简单。直接输入init + 你想要的模式 回车就行。 比如: init 0 就是关机 init 3 就是切换到多用户-命令行模式 init 5 就是切换到图形化界面 init 6 就是重启

设置默认启动级别的方式:

Centos7以前的版本

修改/etc/inittab文件,添加对应id

[chenyh@localhost ~]$ cat /etc/inittab
# inittab is only used by upstart for the default runlevel.
#
# ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# System initialization is started by /etc/init/rcS.conf
#
# Individual runlevels are started by /etc/init/rc.conf
#
# Ctrl-Alt-Delete is handled by /etc/init/control-alt-delete.conf
#
# Terminal gettys are handled by /etc/init/tty.conf and /etc/init/serial.conf,
# with configuration in /etc/sysconfig/init.
#
# For information on how to write upstart event handlers, or how
# upstart works, see init(5), init(8), and initctl(8).
#
# Default runlevel. The runlevels used are:
#   0 - halt (Do NOT set initdefault to this)
#   1 - Single user mode
#   2 - Multiuser, without NFS (The same as 3, if you do not have networking)
#   3 - Full multiuser mode
#   4 - unused
#   5 - X11
#   6 - reboot (Do NOT set initdefault to this)
#
id:5:initdefault:

Centos7之后的版本通过

一般不使用 如果设置默认启动级别为0则开机就立即关闭
systemctl set-default shutdown.target –》 0 如果设置默认启动级别为6则开机就立即重启
systemctl set-default reboot.target –》6

通常设置默认启动级别为3也就是多用户字符模式

# 3 字符模式
systemctl set-default multi-user.target

# 5 图形界面模式
systemctl set-default graphical.target

# 查看当前系统的默认启动级别
systemctl get-default
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇