变化1.今天搭建Memos环境,通过8080端口一直无法访问,查看端口通信一切正常,怀疑是防火墙问题,然后使用service iptables stop来停止,报错如下:
查找资料发现:
变化1..centos 7已经用firewalld取代了Iptables
# systemctl stop firewalld # systemctl disable firewalld
查看防火墙状态 systemctl status firewalld
临时关闭防火墙命令。重启电脑后,防火墙自动起来 systemctl stop firewalld
永久关闭防火墙命令。重启后,防火墙不会自动启动 systemctl disable firewalld
打开防火墙命令 systemctl enable firewalld
注意事项
-
需要root权限
变化2. 用systemtrl取代了service(不过service命令还是可以用的)
注:为了向后兼容,旧的service命令在CentOS 7中仍然可用,它会重定向所有命令到新的systemctl工具。
使用systemctl来启动/停止/重启服务
要启动一个服务,你需要使用如下命令:
# systemctl start httpd.service
这会启动httpd服务,就我们而言,Apache HTTP服务器。
要停掉它,需要以root身份使用该命令:
# systemctl stop httpd.service