- 先安装好数据库+php
- 准备工作
```
# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# systemctl disable --now firewalld
# iptables -L -n
```
- 安装zabbix源
```
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
# # yum install zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql -y
```
- 配置数据库
```
# vim /etc/my.cnf //需要增加配置
character_set_server = utf8
重启mysqld服务后,进入mysql命令行,创建zabbix库
mysql> create database zabbix character set utf8;
创建用户
mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'yantou';
```
- 导入数据
```
# cd /usr/share/doc/zabbix-server-mysql-4.0.29/
# gzip -d create.sql.gz
# mysql -uroot -p zabbix < create.sql
# yum install -y httpd
# systemctl start httpd
```
配置server配置文件
```
# vim /etc/zabbix/zabbix_server.conf //修改或增加
# DBHost=127.0.0.1//在DBName=zabbix上面增加
# DBPassword=yantou //在DBuser下面增加
# systemctl start zabbix-server
# systemctl enable zabbix-server
# netstat -lntp |grep zabbix //查看监听端口
```
- 浏览器访问http://ip/zabbix/ web界面下面配置zabbix
- 用户名Admin 密码zabbix
可能会出现以下问题
```
问题 Time zone for PHP is not set (configuration parameterdate.timezone)
解决找到php.ini文件修改配置
date.timezone=Asia/Shanghai //将最前面的分号去掉,上面时区改成亚洲上海。
查看并修改/etc/httpd/conf.d/zabbix.conf配置文件的配置
php_value date.timezone Asia/Shanghai //修改时区
# service httpd restart
```
- 忘记Admin密码
```
进入mysql命令行,选择zabbix库
mysql -uroot -p zabbix
update users set passwd=md5(‘newpasswd’) where alias=‘Admin’;
这样就更改了Admin用户的密码
```