
环境要求
请先自行安装:nginx、php、mysql
博主的是 nginx1.16 php7.3 mysql8.0.17
到官网下载最新版本:(源官网安装教程地址)
https://www.zabbix.com/download?zabbix=4.4&os_distribution=centos&os_version=7&db=mysql
安装 Zabbix rpm包
# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm # yum clean all
安装Zabbix服务\前端\代理
//如果是apache
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-apache-conf
//如果是使用NGINX:
# yum -y install epel-release
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-nginx-conf
//如果使用高于5.6版本的php,此句无效,请使用下面的命令进行安装
//指定使用php73的依赖,请按自己的版本指定
# yum -y install --enablerepo=remi-php73 zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-nginx-conf
创建数据库用户并添加数据库
# mysql -uroot -p password mysql> create database zabbix character set utf8 collate utf8_bin; //创建数据库 mysql> set global validate_password.policy=LOW; //允许不严格的密码 mysql> create user 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY 'you_password'; //创建用户并加入密码 mysql> grant all privileges on zabbix.* to zabbix@localhost; //加权限 mysql> FLUSH PRIVILEGES; //刷新权限表 mysql> quit;
导入数据到数据库
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -f zabbix -p
配置Zabbix server数据库
# vi /etc/zabbix/zabbix_server.conf DBPassword=password
配置PHP前端
Edit file /etc/httpd/conf.d/zabbix.conf (or, if you prefer NGINX web server, /etc/nginx/conf.d/zabbix.conf),
uncomment and set the right timezone for you.
# vi /etc/nginx/conf.d/zabbix.conf # php_value date.timezone Europe/Riga or, if you prefer NGINX web server: # listen 80; # server_name example.com; # date.timezone = Asia/Shanghai
开启Zabbix server and agent processes
# systemctl restart zabbix-server zabbix-agent httpd # systemctl enable zabbix-server zabbix-agent httpd or, if you prefer NGINX web server # systemctl restart zabbix-server zabbix-agent nginx php-fpm # systemctl enable zabbix-server zabbix-agent nginx php-fpm
访问浏览器
http://server_ip_or_name/zabbix