• 【原创】CentOS9安装Zabbix6.4


    安装CentOS9 Stream

    使用最小化安装即可。
    如果在Esxi虚拟机中安装,请选用BIOS固件(不要选建议的EFI,否则无法安装)。

    CentOS9升级

    安装完毕CentOS9之后,在root权限下执行如下指令

    yum update -y
    
    • 1

    修改CentOS安全属性

    关闭防火墙

    systemctl stop firewalld.service
    systemctl disable firewalld.service
    
    • 1
    • 2

    关闭selinux

    setenforce 0
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    
    • 1
    • 2

    安装mysql8社区版

    移除之前的库

    yum remove -y mysql
    find / -name mysql 
    
    • 1
    • 2

    然后将找到的全删掉

    rm -rf /var/lib/selinux/targeted/active/modules/100/mysql
    
    • 1

    安装mysql

    yum install wget -y
    wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
    yum install mysql80-community-release-el8-1.noarch.rpm -y
    yum install -y mysql-community-server --nogpgcheck
    
    • 1
    • 2
    • 3
    • 4

    配置mysql

    修改/etc/my.cnf

    vi /etc/my.cnf
    
    • 1

    取消此行注释

    default-authentication-plugin=mysql_native_password
    
    • 1

    启动mysql

    systemctl enable mysqld
    systemctl start mysqld
    
    • 1
    • 2

    安装Zabbix

    注意:最后一行zabbix-agent2,与官方包(zabbix-agent)不一致。

    rpm -Uvh https://repo.zabbix.com/zabbix/6.4/rhel/9/x86_64/zabbix-release-6.4-1.el9.noarch.rpm
    yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent2
    
    • 1
    • 2

    导入初始化数据

    查找mysql root 临时密码

    grep 'temporary password' /var/log/mysqld.log
    [root@CentOS9 ~]# grep 'temporary password' /var/log/mysqld.log
    2023-09-27T07:00:22.581536Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: *(dqflf!;33A
    
    • 1
    • 2
    • 3

    创建mysql数据库

    mysql -uroot -p
    password
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Abc@123.com';
    mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
    mysql> create user zabbix@localhost identified by 'Abc@123.com';
    mysql> grant all privileges on zabbix.* to zabbix@localhost;
    mysql> set global log_bin_trust_function_creators = 1;
    mysql> quit;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    导入数据

    zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
    
    • 1

    这里需要多等一等,时间比较久。

    关闭 log_bin_trust_function_creators选项

    mysql -uroot -p
    password
    mysql> set global log_bin_trust_function_creators = 0;
    mysql> quit;
    
    • 1
    • 2
    • 3
    • 4

    配置Zabbix 数据库

    vi /etc/zabbix/zabbix_server.conf
    
    • 1

    取消DBPassword注释,并赋值
    DBPassword=Abc@123.com

    启动Zabbix server和agent进程

    systemctl restart zabbix-server zabbix-agent2 httpd php-fpm
    systemctl enable zabbix-server zabbix-agent2 httpd php-fpm
    
    • 1
    • 2

    安装中文包

    yum install langpacks-zh_CN.noarch
    
    • 1

    访问网站

    http://x.x.x.x/zabbix/
    Admin
    zabbix

  • 相关阅读:
    React常用hooks总结
    基于Spring Boot + Vue的电影购票系统
    css标签及其作用
    14:00面试,14:06就出来了,问的问题有点变态。。。
    [VIM]spcaevim
    springboot+shiro+layuimini实现后台管理系统的权限控制(一)基础环境搭建
    海外IP代理科普——API代理是什么?怎么用?
    【C/C++】深入了解GCC编译器:命令使用及参数解释
    5. HTTPS的特点
    4种方法解除ZIP压缩文件的密码保护
  • 原文地址:https://blog.csdn.net/u013667796/article/details/133350858