ZABBIX 二进制安装
使用阿里云镜像:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
安装epel-release:
yum install epel-release
--报错:已加载插件:fastestmirror,...file contains no section headers. 则解决办法?
rm -f /etc/yum.repos.d/'*' 删除yum.repos.d目录下所有文件
阿里云重新下载:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
安装Development Tools 常用开发组件工具组
yum groups install "Development Tools"
yum groups info "Development Tools" -- 查看
安装zabbix镜像源
rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
LInux系统配置:
systemctl stop firewalld
systemctl disable frrewalld
vim /etc/selinux/config
SELINUX=disabled
重启:reboot
安装zabbix-server-mysql、zabbix-web-mysql rpm包
--可通过 yum search zabbix 搜索包名
yum install zabbix-server-mysql --zabbix server安装
yum install zabbix-web-mysql --zabbix 前端安装
--yum remove zabbix50 解除新旧版本冲突问题 重新安装正确的版本即可
安装数据库
yum install mariadb-server
初始化mysql:
mysql_secure_installation
添加用户与权限配置:
grant 权限 on 数据库.* to username@登录主机 identified by 'password';
grant all privileges on zabbix.* to zabbix@localhost identified by 'password'
错误信息:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL serve
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'password'; 发现用户zabbix已经被添加成功 select user,host from mysql.user;
grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
在mysql8.0创建用户和授权和之前相比更严格需要先创建用户和设置密码然后才能授权。
1、create user 'username'@'localhost' identified by 'password'; --创建用户
2、grant all privileges on zabbix.* to 'zabbix'@'localhost' with grant option; --授权
3、flush privileges; --刷新权限
如果按以前的方式来做,那就会报语法错误 如下:
grant 权限 on 数据库.* to username@登录主机 identified by 'password';
grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL serve
导入zabbix 数据库表结构及相关数据:
zcat /usr/share/doc/zabbix-server-mysql-4.0.39/create.sql.gz |mysql -u zabbix -pzabbix zabbix
验证:
show tables; -- 144张表
配置zabbix server
vim /etc/zabbix/zabbix_server.conf
维护与数据库设置的一致 去掉前面#
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动zabbix server:
systemctl start zabbix-server.service
systemctl status zabbix-server.service
zabbix server 启动失败
相关文档 :https://blog.csdn.net/weixin_43713949/article/details/119453122
zabbix log日志报错:
48046:20220405:194755.848 using configuration file: /etc/zabbix/zabbix_server.conf
48046:20220405:194755.851 [Z3001] connection to database 'zabbix' failed: [2059] Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/mysql/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory
原因:密码加密方式【caching_sha2_password】,客户端不支持 mysql更新至8版本 没有指定用户加密方式 被默认设置为 caching_sha2_password
mysql> show variables like 'default_authentication_plugin'; --查看加密方式
mysql> select host,user,plugin from mysql.user; --查看用户加密方式信息
mysql> ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root_password'; -- 修改加密方式
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements --修改时会报密码策略问题异常信息
相关文档:https://blog.csdn.net/u013449046/article/details/106455041/
1、查看 mysql 初始的密码策略
show variables like 'validate_password%';
2、validate_password_policy 的全局参数为 LOW
set global validate_password.policy=LOW;
set global validate_password.length=6; mysql 设置简单密码,只要满足六位的长度
重新修改加密方式
mysql> ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbix';
重新启动zabbix server
zabbix-server.service - Zabbix Server
Loaded: loaded (/usr/lib/systemd/system/zabbix-server.service; disabled; vendor preset: disabled)
Active: active (running) since 二 2022-04-05 19:48:06 CST; 12min ago
配置zabbix 前端
vim /etc/php.ini
date.timezone =Asia/shanghai
max_execution_time = 300
max_input_vars = 10000
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
always_populate_raw_post_data = -1
systemctl start httpd.service --启动httpd 服务
启动失败:
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details
netstat -antlp | grep 80 --端口占用
systemctl stop nginx.service --nginx占用 停止nginx
systemctl start httpd.service --重新启动即可
特别声明:以上内容(如有图片或视频亦包括在内)为自媒体平台“网易号”用户上传并发布,本平台仅提供信息存储服务。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.