1.安装zabbix yum 源
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
2.Install Zabbix server and agent
# yum install -y zabbix-server-mysql zabbix-agent
3. Install Zabbix frontend
Enable Red Hat Software Collections
# yum-config-manager --enable rhel-server-rhscl-7-rpms
编辑配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
yum install -y zabbix-web-mysql-scl zabbix-apache-conf-scl
4.创建初始数据库
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'Admin@20789';
mysql> grant all privileges on zabbix.* to zabbix@localhost with grant option;;
mysql> alter user 'zabbix'@'localhost' identified with mysql_native_password by "Admin@20789"; (连接native)
mysql>flush privileges;
mysql>quit;(本人用的数据库为8.0)
5.导入初始架构和数据,系统将提示您输入新创建的密码。
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
6.为Zabbix server配置数据库,编辑配置文件 /etc/zabbix/zabbix_server.conf
DBHost=localhost #数据库对外的主机
DBName=zabbix #数据库名称
DBUser=zabbix #数据库用户
DBPassword=zabbix #数据库密码
#这里的配置文件打开后:如果有的就不用添加了。如果是注释了的也不用取消注释。直接把内容复制粘贴过去就可以 了。
7.编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, uncomment and set the right timezone for you
php_value[date.timezone] = Asia/Shanghai #把前面的;去掉
8.启动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
9.连接到新安装的Zabbix前端: http://server_ip_or_name/zabbix