Centos 7.9 zabbix5.0LTS httpd mariadb PHP
安装zabbix5.0存储库
rpm -ivh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
``
安装zabbix软件包
```bash
yum -y install zabbix-server-mysql zabbix-agent
下载CentOS的SCL仓库
bash
yum -y install centos-release-scl
启用zabbix-frontend存储库
bash
vim/etc/yum.repos.d/zabbix.repo
enabled=1#启用仓库
安装Zabbix前端软件包
bash
yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl
安装数据库软件
bash
yum -y install mariadb-server
启动数据库服务
bash
systemctl start mariadb
进入数据库
mysql
创建存储数据的库,并支持中文(库名:zabbix)
bash
MariaDB[(none)]>create database zabbix character set utf8 collate utf8_bin;
创建连接数据库的用户,并设置密码(用户名:zabbix)
bash
MariaDB[(none)]>create user zabbix@localhost identified by '123456';
数据库授权
bash
MariaDB[(none)]>grant all privileges on zabbix.* to zabbix@localhost;
在Zabbix服务器主机上,导入初始架构和数据
bash
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql-u zabbix -p 123456
为Zabbix服务器配置数据库
bash
vim /etc/zabbix/zabbix_server.conf
100 DBName=zabbix #存储监控数据的库名
116 DBUser=zabbix #连接数据库的用户
124 DBPassword=123456 #设置zabbix用户密码
为Zabbix配置正确的时区
bash
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
php_value[date.timezone]=Asia/Shanghai
启动所有服务
bash
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
设置服务随机自启
bash
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm