部署Zabbix监控

发布时间:2023年12月25日

一、准备环境。(Rocky Linux release 8.9)

1、下载rocky-linux镜像,部署新的虚拟机

2、查看环境是否准备成功。

[root@localhost ~]# cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.9 (Green Obsidian)"

二、正式安装部署(rpm方式)

1、下载rpm源

[root@localhost ~]# dnf install -y https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm

2、更改源

[root@localhost yum.repos.d]#  sed -i 's#http://repo.zabbix.com#https://repo.huaweicloud.com/zabbix#' /etc/yum.repos.d/zabbix.repo

3、安装zabbix sever

[root@localhost yum.repos.d]# dnf install -y zabbix-server-mysql

4、安装zabbix agent

[root@localhost yum.repos.d]# dnf install -y zabbix-agent2.x86_64

5、安装zabbix web

[root@localhost yum.repos.d]# dnf install -y zabbix-web-mysql zabbix-apache-conf.noarch httpd

6、安装数据库

[root@localhost yum.repos.d]# dnf install -y maridb-server
[root@localhost yum.repos.d]# dnf install -y zabbix-sql-scripts.noarch

7、配置数据库

[root@localhost ~]# systemctl enable --now mariadb
Created symlink /etc/systemd/system/mysql.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/mysqld.service → /usr/lib/systemd/system/mariadb.service.
Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service → /usr/lib/systemd/system/mariadb.service.
[root@localhost ~]# getenforce
Disabled
[root@localhost ~]# systemctl is-active firewalld.service
inactive
[root@localhost ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.3.39-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.000 sec)

MariaDB [(none)]> create user 'zabbix'@'localhost' identified by 'zabbix';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to 'zabbix'@'localhost';
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> \q
Bye
[root@localhost ~]# zcat /usr/share/doc/zabbix-sql-scripts/mysql/create.sql.gz | mysql -uzabbix -pzabbix zabbix

8.给zabbix-server配置数据库

[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf
只修改密码即可

9、配php时区,同步时间

[root@localhost ~]# tail -1  /etc/php-fpm.d/zabbix.conf 
php_value[date.timezone] = Asia/Shanghai

10、启动服务,web界面安装(输入自己的ip/zabbix)

[root@localhost ~]# systemctl enable --now httpd zabbix-server.service  php-fpm.service zabbix-agent2.service

三、验证

出现如下页面表示配置成功

文章来源:https://blog.csdn.net/m0_64940629/article/details/135193974
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。