关闭selinux和iptables

  在上mysql的课的时候,老师总是提示千万千万一定要关闭selinux和iptables。不然可能会出现什么乱七八糟的权限问题等等。我也找到一篇文章是关于这个的。

  链接为https://blogs.oracle.com/jsmyth/entry/selinux_and_mysql。

  文章当中说到了两种解决方法,一个是锤子,一个是手术刀。本人现在水平有限,就只用锤子就可以了,简单有效。

  永久性的关闭selinux

  编辑文件 /etc/selinux/config

# 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
把配置文件当中的绿色部分改成disabled,然后重启就可以了。
重启以后,用getenforce 来查看是否关闭成功。

如果出现Disabled,就表示你关闭成功了。

 

现在是永久停止iptables的时候。

先查看iptables的状态。

输入命令 systemctl status iptables.service 

如果出现Active: active (exited) 表示你还是开着的。

想要关闭的话很简单,

先用systemctl stop iptables.service

然后再用systemctl disable iptables.service 就可以了。

 

posted @ 2015-12-18 16:23  weixp  阅读(2220)  评论(1编辑  收藏  举报