centos 7怎么修改默认运行级别
答案:2 悬赏:80 手机版
解决时间 2021-02-05 10:46
- 提问者网友:富士山上尢
- 2021-02-04 22:35
centos 7怎么修改默认运行级别
最佳答案
- 五星知识达人网友:平生事
- 2021-02-05 00:09
1)查看当前运行的级别
# runlevel [root@chezhi chezhi]# runlevel N 3 [root@chezhi chezhi]#
如果系统当前默认运行级别是图形GUI模式则runlevel 显示结果为: 5 3
2)修改开机默认运行级别
systemd使用链接来指向默认的运行级别,由/etc/systemd/system/default.target文件中决定。
切换到运行级3:
a. 先删除: mv /etc/systemd/system/default.target /etc/systemd/system/default.target_copy5 #将文件重命名即可
b. 创建软连接文件: ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
或者
ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target
# runlevel [root@chezhi chezhi]# runlevel N 3 [root@chezhi chezhi]#
如果系统当前默认运行级别是图形GUI模式则runlevel 显示结果为: 5 3
2)修改开机默认运行级别
systemd使用链接来指向默认的运行级别,由/etc/systemd/system/default.target文件中决定。
切换到运行级3:
a. 先删除: mv /etc/systemd/system/default.target /etc/systemd/system/default.target_copy5 #将文件重命名即可
b. 创建软连接文件: ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
或者
ln -sf /lib/systemd/system/runlevel3.target /etc/systemd/system/default.target
全部回答
- 1楼网友:玩世
- 2021-02-05 01:48
在linux中有7种启动级别:
修改系统启动级别:修改系统默认启动到3多用户状态,在linux中有7种启动级别,默认是x-window,像是windows的窗口模式,而linux的操作和配置一般都采用输入命令的方式来完成,需要更改默认启动级别才可以实现。
第1步:以管理员身份进入linux,修改文件:/etc/inittab文件。
第2步:找到“id:5:initdefault:”,其中的5就是x-window,为默认运行级别,把5改为3即可。
7总运行级别介绍如下:
# 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)
各个运行级的详细解释:
0 为停机,机器关闭。
1 为单用户模式,就像win9x下的安全模式类似。
2 为多用户模式,但是没有nfs支持。
3 为完整的多用户模式,是标准的运行级。
4 一般不用,在一些特殊情况下可以用它来做一些事情。例如在笔记本电脑的电池用尽时,可以切换到这个模式来做一些设置。
5 就是x11,进到x window系统了。
6 为重启,运行init 6机器就会重启。
0和6一般不用;
运行startx可启动到级别5。
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯