文章目录
修改主机名
hostnamectl set-hostname zyj86
hostnamectl set-hostname zyj87
部署zabbix-server
安装mysql
mkdir packages
tar -xf mysql-8.0.36-1.el8.x86_64.rpm-bundle.tar -C packages/
cd packages
yum install -y ./*
systemctl enable --now mysqld
cat /var/log/mysqld.log | grep pass
2024-10-12T11:38:07.021454Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: hHuk/UeP!0LQ
mysqladmin -uroot password aaA...111 -p
MySQL安全配置向导
mysql_secure_installation
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
systemctl restart mysqld.service
# 可选
# 设置root可以远程连接
update user set host='%' where user='root';
grant all privileges on *.* to root@"%";
flush privileges;
安装zabbixserver
# 配置yum仓库
rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-5.el8.noarch.rpm
dnf clean all
# 安装Zabbix server,Web前端,agent
dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent zabbix-get
# 创建初始数据库
mysql> drop user zabbix@'localhost';
mysql> flush privileges;
mysql -uroot -paaA...111
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user 'zabbix'@'localhost' identified by 'aaA...111';
mysql> grant all privileges on zabbix.* to'zabbix'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
# 导入初始架构和数据,系统将提示您输入新创建的密码。
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
# Disable log_bin_trust_function_creators option after importing database schema.
mysql -uroot -paaA...111
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
# 为Zabbix server配置数据库
编辑配置文件 vim /etc/zabbix/zabbix_server.conf
DBPassword=aaA..111
# 启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
systemctl restart zabbix-server zabbix-agent httpd php-fpm
systemctl enable zabbix-server zabbix-agent httpd php-fpm
web界面进行安装,访问 192.168.3.86:80/zabbix
点击下一步后 这里遇到一个错误: php版本低,不支持使用mysql的caching_sha2_password验证插件
无法连接到数据库 The server requested authentication method unknown to the client
PHP 7.2.8和PHP 7.1.20已经可以支持caching_sha2_password,直接连接MySQL8。
切换php版本至7.4
dnf module switch-to php:7.4
重启httpd服务
systemctl restart httpd
再次点击下一步继续安装即可
安装完成
默认登录账号密码为: Ad