CentOS修改默认运行级别

CentOS修改默认运行级别
 
[1] 修改默认运行级别,默认只启用命令行界面,可以节省资源
 
如下,修改inittab文件中的默认启动级别,由5改至3。(注意:默认运行级别不要设置为0或6)
  www.2cto.com  
各启动级别含义如下:
 
0 停机,机器关闭。 
1 单用户模式,就像Win9x下的安全模式类似。 
2 多用户模式,但是没有NFS支持。 
3 完整的多用户模式,是标准的运行级。 
4 预留,未使用 
5 就是X11,进到X Window 系统了。 
6 为重启,运行init 6机器就会重启。
 
[root@localhost ~]# vim /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).
#  www.2cto.com  
# 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:3:initdefault:
 
[2] 禁用SE Linux
 
[root@localhost ~]# vi /etc/sysconfig/selinux
  www.2cto.com  
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
 
修改后重启Linux或使用setenforce 0命令实时禁用SELinux
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
CentOS 7中,你可以使用systemctl命令来切换运行级别。在CentOS 7中,运行级别被称为"targets"。你可以使用以下命令来查看当前的默认目标: systemctl get-default 要更改默认目标,你可以使用以下命令: systemctl set-default [TARGET.target] 请注意,应替换为你想要设置的目标。例如,如果你想将运行级别切换到命令行模式(类似于runlevel 3),你可以运行以下命令: systemctl set-default multi-user.target 这将将默认目标设置为multi-user.target,这对应于运行级别3。下次系统启动时,系统将进入命令行模式。 引用<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [centos7更改用户的默认运行级别](https://blog.csdn.net/weixin_45745902/article/details/106968559)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [centos7的运行级别设置](https://blog.csdn.net/fengyuhao16/article/details/122804449)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值