centos6、centos7的启动管理系统运行级别

好闲,来写点东西

1.centos6.x下的运行级别

《centos6、centos7的启动管理系统运行级别》 偷的图

一般最常用的就是3或5

查看当前级别 runlevel

[root@ecs-6225 etc]# runlevel

3 3

解释一下:第一个3是你之前运行级别,后一个是当前运行级别

使用 init 级别 来切换运行级别

[root@ecs-6225 etc]# init 5

[root@ecs-6225 etc]# runlevel

3 5
再解释一下:这里切换到5,图形模式,然后runlevel查看一下

但是,为什么没有切换到桌面呢,因为你如果系统没装桌面的话,这里的当前级别就是骗你的,虽然是5,但其实还是3

那么,开机的时候默认是哪个级别呢即系统默认运行级别这个就比较重要了

配置文件:vim  /etc/inittab

文件内容如下:

《centos6、centos7的启动管理系统运行级别》 /etc/inittab文件内容

看到了吗,最后一行,默认级别就是3,如果想修改默认级别,就修改这个文件吧


2.centos7.x下的运行级别

这个必须要讲一下,因为centos6.x中的运行级别已经被取消了,我们再打开上面那个配置文件看一下,

配置文件:vim  /etc/inittab

《centos6、centos7的启动管理系统运行级别》 centos7下的 /etc/inittab文件内容吗

大概意思就是有两种模式:

multi-user.target:类似于centos6.x中的3级别

graphical.target类似于centos6.x中的5级别

然后怎么查看和切换当前级别呢,自然也和之前不一样了,这个文件也说了

# systemd uses ‘targets’ instead of runlevels. By default, there are two main targets:

系统使用targets替代了runlevels

查看当前级别:systemctl get-default

[root@iZuf6dyqve8yycg9cghg8xZ ~]# systemctl get-default

multi-user.target

切换:systemctl set-default multi-user.target 

[root@iZuf6dyqve8yycg9cghg8xZ ~]# systemctl set-default multi-user.target

输出略,自己试试吧

嗯,完事了

    原文作者:火车叨位去去
    原文地址: https://www.jianshu.com/p/b7bbda098410
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞