centos出现“FirewallD is not running”怎么办
centos not is 出现 怎么办 running Firewalld
2023-09-11 14:19:36 时间
centos出现“FirewallD is not running”怎么办
最近在阿里云服务器centos上安装了mysql数据库,默认是不开启远端访问功能,需要设置一下防火墙,在开放默认端口号 3306时提示FirewallD is not running,经过排查发现是防火墙就没打开造成的,出于安装考虑还是把防火墙开上吧,以下步骤仅供参考啦。
先说下systemctl命令
https://www.cnblogs.com/zwcry/p/9602756.html
https://blog.csdn.net/skh2015java/article/details/94012643
Linux 服务管理两种方式service和systemctl
systemd是Linux系统最新的初始化系统(init),作用是提高系统的启动速度,尽可能启动较少的进程,尽可能更多进程并发启动。
systemd对应的进程管理命令是systemctl
1. systemctl命令兼容了service
即systemctl也会去/etc/init.d目录下,查看,执行相关程序
systemctl redis start
systemctl redis stop
# 开机自启动
systemctl enable redis
2.systemctl命令管理systemd的资源Unit
systemd的Unit放在目录/usr/lib/systemd/system(Centos)或/etc/systemd/system(Ubuntu)
主要有四种类型文件.mount,.service,.target,.wants
.mount文件
.mount文件定义了一个挂载点,[Mount]节点里配置了What,Where,Type三个数据项
等同于以下命令:
mount -t hugetlbfs /dev/hugepages hugetlbfs
.service文件
.service文件定义了一个服务,分为[Unit],[Service],[Install]三个小节
[Unit]
Description:描述,
After:在network.target,auditd.service启动后才启动
ConditionPathExists: 执行条件
[Service]
EnvironmentFile:变量所在文件
ExecStart: 执行启动脚本
Restart: fail时重启
[Install]
Alias:服务别名
WangtedBy: 多用户模式下需要的
.target文件
.target定义了一些基础的组件,供.service文件调用
.wants文件
.wants文件定义了要执行的文件集合,每次执行,.wants文件夹里面的文件都会执行
方法/步骤
- 执行
firewall-cmd --permanent --zone=public --add-port=3306/tcp
,提示FirewallD is not running,如下图所示。
- 通过
systemctl status firewalld
查看firewalld状态,发现当前是dead状态,即防火墙未开启。
- 通过
systemctl start firewalld
开启防火墙,没有任何提示即开启成功。
- 再次通过
systemctl status firewalld
查看firewalld状态,显示running即已开启了。
相关文章
- U盘安装centos 7 提示 “Warning: /dev/root does not exist, could not boot” 解决办法
- rocketmq-client-cpp 报错centos RPM should not be used directly install RPM packages, use Alien instead
- CentOS 7中sublime text 3设置中文菜单
- 【实现操作系统 01】CentOS 9 安装配置 Bochs 2.7 虚拟机,及编写简单的 bootloader 并写入软盘启动
- 如何在CentOS 7中禁止IPv6
- Mysql集群-----(02) VirtualBox 复制CentOS (克隆Centos)
- centos启动Nginx提示nginx: [emerg] still could not bind()
- Centos基础环境搭建--安装docker
- centos不联网Linux添加gcc,CentOS下离线安装gcc环境,图文详细,方法全面
- zabbix调试脚本报错(Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.)
- Linux-023-Centos Nginx Lua 脚本三种基本引用方式示例
- CentOS 6.x启动时网卡eth0未激活
- Centos下抓包
- #Centos Centos7配置NTP服务端和客户端
- How to set JAVA environment variables in Linux or CentOS
- CentOS 7安装 ifconfig 管理命令
- 【Linux/CentOS】Boolean ftp_home_dir is not defined
- Linux CentOS 安装 宝塔
- Linux CentOS 系统安装 和 相关配置
- centos 专题-各种配置应有尽有
- Centos 7 配置 VNCServer 經驗