CentOS7关闭SELINUX

安全增强型Linux(Security-Enhanced Linux)简称SELinux,它是一个 Linux 内核模块,也是Linux的一个安全子系统。为了避免安装过程出现各种错误,建议关闭,有如下两种关闭方法:

1)临时关闭(不建议使用)

[root@hadoop101 ~]# setenforce 0

但是这种方式只对当次启动有效,重启机器后会失效。

2)永久关闭(建议使用)

修改配置文件/etc/selinux/config

[root@hadoop101 ~]# vim /etc/selinux/config

将SELINUX=enforcing 改为SELINUX=disabled

# 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=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

3)同步/etc/selinux/config配置文件(这一步是针对集群环境中,参考:使用集群同步脚本对配置文件同步分发

[root@hadoop101 ~]# xsync /etc/selinux/config

4)重启主机

[root@hadoop101 ~]# reboot

[root@hadoop102 ~]# reboot

[root@hadoop103 ~]# reboot

 

posted @ 2019-08-14 10:51  猫不夜行  阅读(7737)  评论(0编辑  收藏  举报