centos安装zabbix4客户端 (centos7 zabbix4虚拟机版本)

centos7.9安装zabbix4.4

部署方法参考官网

官网地址

https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&components=server_frontend_agent&db=mysql&ws=apache

centos7.7安装zabbix,centos7zabbix4虚拟机版本

关闭防火墙和SELINUX安全模式

#关闭防火墙并设置开机不启动
[root@zabbix-server ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

关闭SElinux安全模式
[root@zabbix-server ~]# setenforce 0
[root@zabbix-server ~]# getenforce
Permissive
[root@zabbix-server ~]# vi /etc/selinux/config
修改以下内容:
SELINUX=disabled
按:wq保存退出即可。重启生效。
[root@zabbix-server ~]# reboot

添加 Zabbix 软件仓库

安装软件仓库配置包,这个配置包含了 yum(软件包管理器)的配置文件。

# rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
# yum clean all

安装Zabbix server,Web前端,agent

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent

安装 Zabbix proxy 并使用 MySQL 数据库:

# yum install zabbix-proxy-mysql

安装配置mysql5.7

*载下**mysql官网的仓库

wget -i -c https://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm

安装mysql仓库

yum -y install mysql57-community-release-el7-10.noarch.rpm

安装mysql服务

yum -y install mysql-community-server

启动mysql服务并设置开机启动

systemctl start mysqld.service
systemctl enable mysqld.service

查找mysql的root初始密码(本例初始密码:HCrg+=WWp2yj)

[root@localhost ~]# grep "password" /var/log/mysqld.log
2022-12-01T22:08:41.639829Z 1 [Note] A temporary password is generated for root@localhost: HCrg+=WWp2yj
[root@localhost ~]#

用初始密码登录数据库

[root@localhost ~]# mysql -uroot -p
Enter password:HCrg+=WWp2yj
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.40

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

执行下面命令更改root初始密码为:lkS1Rc4du_M_

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'lkS1Rc4du_M_';
Query OK, 0 rows affected (0.00 sec)

mysql>

创建初始数据库

# mysql -uroot -p
password
mysql> set global validate_password_policy=0;
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;

导入数据

使用 MySQL 来导入 Zabbix server 的初始数据库 schema 和数据,

zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz | mysql -uzabbix -p zabbix

导入初始架构和数据,系统将提示您输入新创建的密码。

对于 Zabbix proxy,导入初始的数据库 schema:

# zcat /usr/share/doc/zabbix-proxy-mysql*/schema.sql.gz | mysql -uzabbix -p zabbix

为Zabbix server配置数据库

编辑配置文件 /etc/zabbix/zabbix_server.conf

DBPassword=password

为Zabbix前端配置PHP时区

编辑配置文件 /etc/httpd/conf.d/zabbix.conf uncomment and set the right timezone for you.

# php_value date.timezone Asia/Shanghai

启动Zabbix server和agent进程

启动Zabbix server和agent进程,并为它们设置开机自启:

# systemctl restart zabbix-server zabbix-agent httpd
# systemctl enable zabbix-server zabbix-agent httpd

配置zabbix前端

浏览器访问进行前端配置和初始化 http://server_ip/zabbix

centos7.7安装zabbix,centos7zabbix4虚拟机版本

centos7.7安装zabbix,centos7zabbix4虚拟机版本

centos7.7安装zabbix,centos7zabbix4虚拟机版本

设置名

centos7.7安装zabbix,centos7zabbix4虚拟机版本

centos7.7安装zabbix,centos7zabbix4虚拟机版本

配置完成

centos7.7安装zabbix,centos7zabbix4虚拟机版本

登录界面(默认用户名密码:Admin/zabbix)

centos7.7安装zabbix,centos7zabbix4虚拟机版本

进入界面

centos7.7安装zabbix,centos7zabbix4虚拟机版本