1、安装环境
准备一台服务器
关闭防火墙和selinux
2、yum安装mysql5.7.43
#下载安装mysql源
yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-11.noarch.rpm
#打开5.7.43源关闭8.0的源
yum-config-manager --disable mysql80-community && yum-config-manager --enable mysql57-community
#安装mysql
yum -y install mysql-community-server
#启动mysql数据库
systemctl start mysqld
#修改mysql数据库密码
mysqladmin -uroot -p"$(awk '/temporary password/{p=$NF}END{print p}' /var/log/mysqld.log)" password "QQqq123@123"
3、安装zabbix服务
1)安装Zabbix存储库
[root@localhost ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@localhost ~]# yum clean all
2)安装Zabbix server,Web前端,agent
[root@localhost ~]# yum -y install zabbix-server-mysql zabbix-agent
3)安装Zabbix前端
[root@localhost ~]# yum -y install centos-release-scl
4)编辑配置文件 /etc/yum.repos.d/zabbix.repo
[root@localhost ~]# vim /etc/yum.repos.d/zabbix.repo
打开zabbix-frontend 源
5)安装Zabbix前端软件包
[root@localhost ~]# yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
6)创建初始数据库
#登录mysql数据库
[root@localhost ~]# mysql -u root -p'QQqq123@123'
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'QQqq123@123';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> \q
7)导入初始架构和数据,系统将提示您输入新创建的密码
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
8)导入数据库架构后禁用log_bin_trust_function_creators选项
#登录mysql数据库
mysql -uroot -p'QQqq123@123'
mysql> set global log_bin_trust_function_creators = 0;
mysql> \q
9)为Zabbix server配置数据库,编辑配置文件 /etc/zabbix/zabbix_server.conf
[root@localhost ~]# vim /etc/zabbix/zabbix_server.conf
打开124行注释并添加zabbix库授权密码
10)修改php-fpm服务启动用户
[root@localhost ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
用户与组和监听用户改为nginx,最后一行注释打开改成对应时区
[root@localhost ~]# chown .nginx /var/opt/rh/rh-php72/lib/php/session/
[root@localhost ~]# chown nginx.nginx -R /etc/zabbix/web/
11)将配置文件中的server模块删除掉
[root@localhost ~]# vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
12)启动Zabbix server和agent进程,并为它们设置开机自启
[root@localhost ~]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
13)访问10.36.192.129网页
点击Next step
点击Next step
输入对应信息密码是zabbix库授权密码后点击Next step
host和name自行设置(与服务器主机名一致或在服务器上做域名解析)名称点击Next step
点击Next step
点击Next step
默认账号Admin 密码zabbix 点击Sign in登录
zabbix服务端配置完成
14)修改语言
进入设置页面
修改中文
点击Update
自动部署shell小脚本