[toc]
CentOS7安装zabbix5.0
1.标准安装
1.1 添加yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
1.2 安装zabbix-server和zabbix-agent
yum -y install zabbix-server-mysql zabbix-agent
1.3 安装Zabbix frontend
启用红帽软件集合
yum -y install centos-release-scl
1.4 编辑配置文件/etc/yum.repos.d/zabbix.repo
以使用zabbix-frontend库
[zabbix-frontend]
enabled=1
#使用如下命令修改
sed -i '11s/0/1/' /etc/yum.repos.d/zabbix.repo
1.5 安装Zabbix frontend包
yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
1.6 创建数据库
mysql -e "create database zabbix character set utf8 collate utf8_bin;"
mysql -e "create user zabbix@localhost identified by 'zabbix';"
mysql -e "grant all privileges on zabbix.* to zabbix@localhost;"
1.7 导入数据库
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
1.8 为Zabbix server配置数据库
编辑配置文件/etc/zabbix/zabbix_server.conf
//配置数据库密码
DBPassword=zabbix
#使用如下命令
sed -i.bak '/# DBPassword=/c DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
1.9 为Zabbix前端配置PHP
编辑配置文件/etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
设置时区
sed -i.bak '/^;/c php_value[date.timezone] = Asia/Shanghai' /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf