场景:生产环境部署zabbix监控
部署过程
1. 官方安装文档
https://www.zabbix.com/download?zabbix=4.0&os_distribution=centos&os_version=6&db=MySQL
2. 选择合适的rpm源,注意区分版本
3. 安装rpm源
# rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/6/x86_64/zabbix-release-4.0-1.el6.noarch.rpm
4.安装数据库文件、前端、agent
# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
5.安装及配置数据库
(1)安装Mysql5.7的yum源
# wget https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm
# rpm -ivh /opt/mysql80-community-release-el6-1.noarch.rpm
(2)修改配置文件
修改mysql-community.repo的mysql57-community段中,将enabled=0改成enabled=1
# vim /etc/yum.repos.d/mysql-community.repo
# Enable to use MySQL 5.7
[mysql57-community]
name=MySQL 5.7 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
(3)安装mysql
# yum install mysql-community-server
(4)启动mysql
# /etc/init.d/mysqld start
(5)mysql会分配随机密码,需要查看默认密码并进行修改才能正常使用,否则登录mysql运行任何命令都会提示"You must reset your password using ALTER USER statement before executing this statement."
# grep password /var/log/mysqld.log
2018-12-12T02:59:05.242383Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: VheTj&HWk372
初始密码:VheTj&HWk372
# mysql -uroot -p
(6)添加zabbix用户、调整用户验证模式、授权
mysql> alter user 'root'@'localhost' identified by '123456';
mysql> create user 'zabbix'@'localhost' identified by 'Zabbix@123';
mysql> ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Zabbix@123';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges;
6.启动zabbix-server
# service zabbix-server start
完成
7.登录
地址:http://xx.xx.xx.xx/
默认用户密码:Admin/zabbix