Linux(CentOS7) 关闭防火墙、放开端口以及关闭Selinux
1、 关闭防火墙并设置开机不启动
查看当前状态
[root@xuegod63 ~]# systemctl status firewalld.service #**查看firewalld状态**
[root@xuegod63 ~]# systemctl stop firewalld #**关闭**
[root@xuegod63 ~]# systemctl start firewalld #**开启**
[root@xuegod63 ~]# systemctl disable firewalld #**开机自动关闭 //RHLE7**
[root@xuegod63 ~]# chkconfig —list|grep network #**查看开机是否启动 //RHLE6**
[root@xuegod63 ~]# systemctl enable firewalld #**开机自动启动**
2.、放开端口(设置防火墙)
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
查看当前开放的端口
firewall-cmd --zone=public --list-ports
3、 临时和永久关闭Selinux
临时关闭
[root@xuegod63 ~]# getenforce
Enforcing
[root@xuegod63 ~]# setenforce 0
setenforce: SELinux is disabled
永久关闭
[root@xuegod63 ~]# vim /etc/selinux/config
改:7 SELINUX=enforcing #前面的7,表示文档中第7行。方便你查找
为:7 SELINUX=disabled
[root@xuegod63 ~]# reboot #**重启主机**
还没有评论,来说两句吧...