CentOS 7 安装 Zabbix 5.0

a. 安装Zabbix源
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
修改zabbix官方源,加快下载
打开/etc/yum.repos.d/zabbix.repo,把所有的“https://repo.zabbix.com” 改成 “https://mirrors.aliyun.com/zabbix/” (除了zabbix-non-supported,其他的分支的URL都有两个zabbix)

b. Install Zabbix server and agent
# yum install zabbix-server-mysql zabbix-agent

c. Install Zabbix frontend

# yum install centos-release-scl
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.

[zabbix-frontend]

enabled=1

Install Zabbix frontend packages.
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

d. 创建初始数据库
在数据库主机上运行以下代码。
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by ‘password’;
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
导入初始架构和数据,系统将提示您输入新创建的密码。
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

e. 为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=password

f. 为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, add nginx to listen.acl_users directive.
Then uncomment and set the right timezone for you.
php_value[date.timezone] = Asia/Shanghai

g. 启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:

# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

h. 配置Zabbix前端
连接到新安装的Zabbix前端: http://server_ip_or_name
根据Zabbix文件里步骤操作: Installing frontend