在CentOS 7中如何使用service命令开启服务器
第二个问题‘cannot add dependency job for unit firewalld.service’,建议先停止firewalld服务,使用systemctl stop firewalld命令。之后可以通过iptables -nvL命令来检查防火墙的状态,看看是否配置正常。
第二个问题‘cannot add dependency job for unit firewalld.service’,建议先停止firewalld服务,使用systemctl stop firewalld命令。之后可以通过iptables -nvL命令来检查防火墙的状态,看看是否配置正常。
其实现在CentOS 7默认推荐都是用systemctl来管理服务的,service算是兼容旧版RHEL的命令而已。如果firewalld起不来导致依赖报错,直接systemctl disable --now firewalld可能比stop更彻底。不过既然问题里专门问了service,那回答先stop再查iptables状态确实是最对症的解决办法,简洁明了。
这个问题其实挺典型的,很多新手在CentOS 7上装东西时都会踩到这个坑。firewalld默认是开启的,而且和iptables有些底层冲突,直接报错很正常。建议先stop firewalld,再检查iptables状态,这样思路清晰,也能避免后续配置混乱。