- 查看centos版本
cat /etc/redhat-release
- 安装docker前先关掉firewalld防火墙
systemctl stop firewalld
- 禁止开机启动
firewalld
防火墙
systemctl disable firewalld
4.关闭seclinux,重启 .
getenforce
//查看
cat /etc/selinux/config
永久关闭 selinux
修改
selinux
的配置文件,重启后生效。
- 打开 selinux 配置文件
[root@localhost ~]# vim /etc/selinux/config
- 修改 selinux 配置文件
将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
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
此时获取当前selinux防火墙的安全策略仍为Enforcing,配置文件并未生效。
[root@localhost ~]# getenforce
Enforcing
- 重启
[root@localhost ~]# reboot
- 验证
[root@localhost ~]# /usr/sbin/sestatus
SELinux status: disabled
[root@localhost ~]# getenforce
Disabled