1.下载安装包
关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
关闭selinux
setenforce 0
编写zabbix yum源 vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=alibaba zabbix
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
gpgcheck=0
enabled=1
[zabbix2]
name=alibaba zabbix frontend
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
gpgcheck=0
enabled=1
2.安装zabbix服务器
yum clean all
yum -y install zabbix-server-mysql zabbix-agent
#zabbix-server-mysql(数据库) zabbix-agent(代理程序)
yum install centos-release-scl #centos发布scl
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl #zabbix前台页面
3.安装数据库
yum -y install mariadb mariadb-server #安装数据库
systemctl enable mariadb
systemctl start mariadb #启动数据库
#授权zabbix账号
mysql
mysql> create database zabbix character set utf8 collate utf8_bin; #创建数据库
mysql> create user zabbix@localhost identified by '123456'; #创建zabbix账号
mysql> grant all privileges on zabbix.* to zabbix@localhost; #赋权
mysql> flush privileges; #刷新表
mysql> quit;
#初始化zabbix
ls /usr/share/doc/zabbix-server-mysql-5.0.29/
zcat /usr/share/doc/zabbix-server-mysql-5.0.29/create.sql.gz | mysql -uzabbix -p'123456' zabbix
4.开启zabbix进程
配置sql账号密码 vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456 #只需要修改的密码
启动zabbix
systemctl enable zabbix-server.service
systemctl start zabbix-server.service
5.编辑Zabbix前端的PHP配置
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value date.timezone Asia/Shanghai #将时区改成上海
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
6.用浏览器进行访问
http://zabbix_ip/zabbix
用户admin 默认密码: zabbix