错误重现
[root@ncayu101 data]# systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; enabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since 四 2022-06-09 16:18:54 CST; 6s ago
Process: 34789 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=1/FAILURE)
Process: 34768 ExecStart=/usr/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 34770 (code=exited, status=0/SUCCESS)
6月 09 16:18:54 ncayu101 kill[34789]: -q, --queue <sig> use sigqueue(2) rather than kill(2)
6月 09 16:18:54 ncayu101 kill[34789]: -p, --pid print pids without signaling them
6月 09 16:18:54 ncayu101 kill[34789]: -l, --list [=<signal>] list signal names, or convert one to a name
6月 09 16:18:54 ncayu101 kill[34789]: -L, --table list signal names and numbers
6月 09 16:18:54 ncayu101 kill[34789]: -h, --help display this help and exit
6月 09 16:18:54 ncayu101 kill[34789]: -V, --version output version information and exit
6月 09 16:18:54 ncayu101 kill[34789]: For more details see kill(1).
6月 09 16:18:54 ncayu101 systemd[1]: zabbix-server.service: control process exited, code=exited status=1
6月 09 16:18:54 ncayu101 systemd[1]: Unit zabbix-server.service entered failed state.
6月 09 16:18:54 ncayu101 systemd[1]: zabbix-server.service failed.
看提示中提到SElinux,检查发现确实没有关闭SELinux
[root@ncayu101 data]# getenforce
Enforcing
[root@ncayu101 data]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 31
关闭SELinux
1.以root权限远程连接ECS实例。连接方式请参见连接方式概述。
2.运行命令getenforce,验证SELinux状态。
返回状态如果是enforcing,表明SELinux已开启。
3.选择临时关闭或者永久关闭SELinux。
执行命令setenforce 0临时关闭SELinux。
永久关闭SElinux。
[root@ncayu101 data]# getenforce
Enforcing
# 临时关闭 SELinux
[root@ncayu101 data]# setenforce 0
[root@ncayu101 data]#
[root@ncayu101 data]#
[root@ncayu101 data]# getenforce
Permissive
- a.运行以下命令,编辑SELinux的config文件。
vim /etc/selinux/config - b.找到SELINUX=enforcing,按i进入编辑模式,将参数修改为SELINUX=disabled。
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
我已经修改好了
-
c.修改完成后,按下键盘Esc键,执行命令:wq,保存并退出文件。
-
d.重启ECS实例。
shutdown -r now
- e.重启后,运行命令getenforce,验证SELinux状态为disabled,表明SELinux已关闭。
启动zabbix
systemctl start zabbix-server zabbix-agent httpd rh-php72-php-fpm
# Linux中查看
curl http://192.168.70.133/zabbix/setup.php
在浏览器中查看