CentOS修改默认运行级别,禁用Linux
[1] 修改默认运行级别,默认只启用命令行界面,可以节省资源
如下,修改inittab文件中的默认启动级别,由5改至3。(注意:默认运行级别不要设置为0或6)
www.zhishiwu.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.zhishiwu.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] 禁用SELinux
[root@localhost ~]# vi /etc/sysconfig/selinux
www.zhishiwu.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