zabbix二进制软件包安装

本文档详细介绍了如何在CentOS7系统上安装Zabbix,包括关闭selinux和firewalld,安装httpd、php、mariadb数据库,设置zabbix-server和zabbix-agent,创建数据库,配置相关服务,以及解决访问时可能出现的问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

关闭selinux和firewalld

关闭selinux开机自启

vim /etc/selinux/config

# 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=disabled								#改成disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

关闭selinux

[root@localhost ~]# setenforce 0

检查selinux状态

[root@localhost ~]# getenforce 
Permissive

关闭firewalld并且关闭开机自启

[root@localhost ~]# systemctl disable --now firewalld

检查firewalld状态

[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

3月 31 17:10:35 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
3月 31 17:10:35 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'beyond-scope' is not supported by the kerne...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: beyond-scope: INVALID_ICMPTYPE: No supported ICMP type...ime.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'failed-policy' is not supported by the kern...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: failed-policy: INVALID_ICMPTYPE: No supported ICMP typ...ime.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: ICMP type 'reject-route' is not supported by the kerne...pv6.
3月 31 17:10:35 localhost.localdomain firewalld[843]: WARNING: reject-route: INVALID_ICMPTYPE: No supported ICMP type...ime.
3月 31 09:53:05 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
3月 31 09:53:07 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.

安装web服务、php依赖包、mariadb数据库、zabbix软件包

安装httpd服务

[root@localhost ~]# yum install httpd
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 httpd.x86_64.0.2.4.6-97.el7.centos 将被 安装
--> 正在处理依赖关系 httpd-tools = 2.4.6-97.el7.centos,它被软件包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在处理依赖关系 /etc/mime.types,它被软件包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在处理依赖关系 libaprutil-1.so.0()(64bit),它被软件包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在处理依赖关系 libapr-1.so.0()(64bit),它被软件包 httpd-2.4.6-97.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 apr.x86_64.0.1.4.8-7.el7 将被 安装
---> 软件包 apr-util.x86_64.0.1.5.2-6.el7 将被 安装
---> 软件包 httpd-tools.x86_64.0.2.4.6-97.el7.centos 将被 安装
---> 软件包 mailcap.noarch.0.2.1.41-2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=============================================================================================================================
 Package                      架构                    版本                                    源                        大小
=============================================================================================================================
正在安装:
 httpd                        x86_64                  2.4.6-97.el7.centos                     updates                  2.7 M
为依赖而安装:
 apr                          x86_64                  1.4.8-7.el7                             base                     104 k
 apr-util                     x86_64                  1.5.2-6.el7                             base                      92 k
 httpd-tools                  x86_64                  2.4.6-97.el7.centos                     updates                   93 k
 mailcap                      noarch                  2.1.41-2.el7                            base                      31 k

事务概要
=============================================================================================================================
安装  1 软件包 (+4 依赖软件包)

总下载量:3.0 M
安装大小:10 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                |  92 kB  00:00:00     
(2/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                |  31 kB  00:00:00     
(3/5): apr-1.4.8-7.el7.x86_64.rpm                                                                     | 104 kB  00:00:00     
(4/5): httpd-tools-2.4.6-97.el7.centos.x86_64.rpm                                                     |  93 kB  00:00:00     
(5/5): httpd-2.4.6-97.el7.centos.x86_64.rpm                                                           | 2.7 MB  00:00:06     
-----------------------------------------------------------------------------------------------------------------------------
总计                                                                                         506 kB/s | 3.0 MB  00:00:06     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : apr-1.4.8-7.el7.x86_64                                                                                   1/5 
  正在安装    : apr-util-1.5.2-6.el7.x86_64                                                                              2/5 
  正在安装    : httpd-tools-2.4.6-97.el7.centos.x86_64                                                                   3/5 
  正在安装    : mailcap-2.1.41-2.el7.noarch                                                                              4/5 
  正在安装    : httpd-2.4.6-97.el7.centos.x86_64                                                                         5/5 
  验证中      : httpd-2.4.6-97.el7.centos.x86_64                                                                         1/5 
  验证中      : apr-1.4.8-7.el7.x86_64                                                                                   2/5 
  验证中      : mailcap-2.1.41-2.el7.noarch                                                                              3/5 
  验证中      : httpd-tools-2.4.6-97.el7.centos.x86_64                                                                   4/5 
  验证中      : apr-util-1.5.2-6.el7.x86_64                                                                              5/5 

已安装:
  httpd.x86_64 0:2.4.6-97.el7.centos                                                                                         

作为依赖被安装:
  apr.x86_64 0:1.4.8-7.el7             apr-util.x86_64 0:1.5.2-6.el7        httpd-tools.x86_64 0:2.4.6-97.el7.centos       
  mailcap.noarch 0:2.1.41-2.el7       

完毕!

安装php-fpm php-mysql php-cli

建议使用较低版本的php安装包,过高的php版本可能会在后续配置中产生报错

[root@localhost ~]# yum list php
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
可安装的软件包
php.x86_64                                                 5.4.16-48.el7                                                 bas

安装php-fpm php-mysql php-cli

[root@localhost yum.repos.d]# yum install php-fpm php-mysql php-cli
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * epel: hkg.mirror.rackspace.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
--> 正在检查事务
---> 软件包 php-cli.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 php-common(x86-64) = 5.4.16-48.el7,它被软件包 php-cli-5.4.16-48.el7.x86_64 需要
---> 软件包 php-fpm.x86_64.0.5.4.16-48.el7 将被 安装
---> 软件包 php-mysql.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 php-pdo(x86-64) = 5.4.16-48.el7,它被软件包 php-mysql-5.4.16-48.el7.x86_64 需要
--> 正在检查事务
---> 软件包 php-common.x86_64.0.5.4.16-48.el7 将被 安装
--> 正在处理依赖关系 libzip.so.2()(64bit),它被软件包 php-common-5.4.16-48.el7.x86_64 需要
---> 软件包 php-pdo.x86_64.0.5.4.16-
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值