Zabbix: 安装zabbix7.0
Zabbix: 安装zabbix7.0
(1)操作系统安装
https://rockylinux.org/zh-CN/download
此次选择的操作系统相关版本是:Rocky-8.10-x86_64-minimal.iso
(2)zabbix相关安装文档
https://www.zabbix.com/cn/download
(3)操作系统的提前准备工作(配置固定的ip地址、关闭防火墙)
备注:关闭防火墙不是必须的,你也可以去配置防火墙的规则。
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
停止及关闭防火墙:
systemctl stop firewalld
systemctl disable firewalld
(4.1)安装Zabbix 7.0 yum库
rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/8/x86_64/zabbix-release-7.0-5.el8.noarch.rpm
(4.2)安装Zabbix server,Web前端,agent
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
y
清除系统中已经加载的仓库储存信息
[root@localhost ~]# dnf clean all
40 files removed
[root@localhost ~]#
[root@localhost ~]#
切换为php:8.2
Switch DNF module version for PHP
[root@localhost ~]# dnf module switch-to php:8.2
(5.1)安装数据库mysql
[root@localhost ~]# dnf install mysql-server -y
(5.2)开启并查看数据服、设置数据库服务为开机启动
systemctl start mysqld
systemctl status mysqld
systemctl enable mysqld
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL 8.0 database server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
Active: activating (start-pre) since Wed 2024-09-18 03:39:08 EDT; 22s ago
Process: 26170 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
Cntrl PID: 26195 (mysql-prepare-d)
Tasks: 33 (limit: 203642)
Memory: 216.5M
CGroup: /system.slice/mysqld.service
├─26195 /bin/sh /usr/libexec/mysql-prepare-db-dir mysqld.service
└─26231 /usr/libexec/mysqld --initialize-insecure --datadir=/var/lib/mysql --user=mysql
Sep 18 03:39:08 localhost.localdomain systemd[1]: Starting MySQL 8.0 database server...
Sep 18 03:39:08 localhost.localdomain mysql-prepare-db-dir[26195]: Initializing MySQL database
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# systemctl enable mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost ~]#
(5.3)创建初始数据库
Make sure you have database server up and running.
在数据库主机上运行以下代码。
# mysql -uroot -p (直接回车、回车)
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
在数据库主机上运行以下代码。
# mysql -uroot -p
直接回车
(5.4)导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
# mysql -uroot -p
password ###直接回车即可
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
可以看到,导进了很多表。
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 8.0.36 Source distribution
Copyright (c) 2000, 2024, 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> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host, user, authentication_string, plugin from user;
update user set host = '%' where user = 'root';
select host, user from user;
use mysql;
select host, user from user;
flush privileges;
(5.5)修改mysql的root密码:
mysql>
mysql> ALTER USER 'root'@'%' IDENTIFIED BY '新密码';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
mysql>
(5.6)为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password
(6)启动Zabbix server和agent进程,并为它们设置开机自启:
# systemctl restart zabbix-server zabbix-agent httpd php-fpm
# systemctl enable zabbix-server zabbix-agent httpd php-fpm
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent httpd php-fpm
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /usr/lib/systemd/system/zabbix-server.service.
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /usr/lib/systemd/system/zabbix-agent.service.
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd php-fpm
[root@localhost ~]#
(7.1)zabbix初始化
http://192.168.125.201/zabbix
恩!Zabbix前端已经配置好了!千山万水第一步!加油吧,少年!
配置文件 "etc/zabbix/web/zabbix.conf.php" 已创建。
http://192.168.125.201/zabbix/
Admin
zabbix
安装到此完成。
(8.1)问题:无法执行脚本
从Zabbix 7.0开始,默认情况下会禁用Zabbix服务器上的全局脚本执行,所以当你执行ping等测试时,会显示“无法执行脚本”。
查询官方文档发现:https://www.zabbix.com/documentation/7.0/en/manual
对于新的安装,从Zabbix 7.0开始,默认情况下会禁用Zabbix服务器上的全局脚本执行。可以通过在服务器配置中设置EnableGlobalScripts=1来启用Zabbix服务器上的全局脚本执行。
vi /etc/zabbix/zabbix_server.conf
reboot服务器后就正常了,如下图所示:
完。
2、本资源基本为原创,部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
3、本站大部分文章的截图来源实验测试环境,请不要在生产环境中随意模仿,以免带来灾难性后果。
转载请保留出处: www.zh-cjh.com珠海陈坚浩博客 » Zabbix: 安装zabbix7.0
作者: cjh
手机扫一扫,手机上查看此文章: |
一切源于价值!
其他 模板文件不存在: ./template/plugins/comment/pc/index.htm