最近在安装Tomcat时遇到一个问题,启动Tomcat时报错:Job for iptables.service failed because the control process exited with error code. See “systemctl status iptables.service” and “journalctl -xe” for details.
现在我来说一下解决办法:
因为CentOS7版本后开始,默认是没有iptables防火墙的,而是使用firewall防火墙。本文将屏蔽掉firewall,使用iptables
Centos7版本解决方法:
1、首先停止并屏蔽firewalld服务
停止: systemctl stop firewalld
屏蔽 :systemctl mask firewalld
2、安装iptables-service软件包
yum install iptables-services
3、在引导时启用iptables服务
systemctl enable iptables
4、启动iptables服务
systemctl start iptables
5、保存防火墙规则
service iptables save
再去查看发现已经有了iptables文件
预防:想要改回firewalld防火墙用下面命令
1) 开机自动启动firewalld防火墙
systemctl enable firewalld.service
2)关闭开机制动启动
systemctl disable firewalld.service
3)查看状态
systemctl status firewalld
4)启用防火墙firewalld
systemctl start firewalld.service