安装yum源
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean
yum makecache fast
安装Zabbix server,agent
yum install zabbix-server-mysql zabbix-agent
启用红帽软件合集
yum-config-manager --enable rhel-server-rhscl-7-rpms
编辑配置文件 /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
安装frontend包
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
在zabbix-mysql机器中创建初始数据库
rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-9.noarch.rpm
yum --disablerepo=mysql80-community --enablerepo=mysql57-community -y install mysql-community-server
systemctl enable --now mysqld
mysql -uroot -p
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> set global log_bin_trust_function_creators = 1;
mysql> quit;
在zabbix-server的机器中操作导入初始架构和数据
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -h192.168.153.141 -P 3306 -uzabbix -p zabbix
上式中的IP地址为数据库的IP地址
在zabbix-mysql机器中导入数据库架构后禁用log_bin_trust_function_creators选项。
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBHost=192.168.153.142
DBPassword=password
为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
listen 80;
server_name example.com;
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai
启动三个组件
systemctl enable --now zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
zabbix网页
账号Admin密码默认zabbix