一、zabbix-server端准备工作
1. 在主要服务器搭建LAMP环境
安装apache
yum install -y httpd
安装mysql
yum install -y mariadb mariadb-server
安装php环境
yum install -y php php-mysql
启动服务并设置开机自启
systemctl start httpd systemctl start mariadb-server systemctl start php-mysql
systemctl enable httpd systemctl enable mariadb-server systemctl enable php-mysql
2. 在主要服务器安装zabbix-server
安装php支持zabbix组件
yum install php-bcmath php-mbstring -y
安装mysql支持zabbix组件
yum install zabbix-server-mysql zabbix-web-mysql -y
安装zabbix-server
rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm
安装红帽软件集合
yum install centos-release-scl
安装zabbix前端
yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
2. 配置zabbix-server
①数据库配置
进入数据库
mysql -uroot -p
添加zabbix用户
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'zabbix';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> flush privileges;
mysql> quit;
导入初始架构和数据
cd /usr/share/doc/zabbix-server-mysql*/
gunzip create.sql.gz
进入MySQL执行下面的命令
use zabbix;
source create.sql;
②配置zabbix server
将mysql添加的zabbix账号导入zabbix配置文件
vim /etc/zabbix/zabbix_server.conf
配置php时间
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
将php_value[date.timezone]修改为
php_value[date.timezone] = Asia/Shanghai
③启动zabbix服务,并设置开机自启
systemctl restart zabbix-server httpd rh-php72-php-fpm
systemctl enable zabbix-server httpd rh-php72-php-fpm
④进入web页面
x.x.x.x/zabbix 服务端ip加/zabbix 例:192.168.1.119/zabiix