关闭防火墙和文件防火墙
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
安装zabbix存储库
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
更换zabbix.repo为阿里云
cd /etc/yum.repos.d
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' zabbix.repo #更换源
yum clean all #清理软件源
yum makecache #生成缓存
![](https://img-blog.csdnimg.cn/img_convert/c19db5436974c9794018121eb65d4646.png)
修改zabbix源篇日志(开启安装源)
vi /etc/yum.repos.d/zabbix.repo
找到zabbix-frontend 把enable改成1 #开启安装源
![](https://img-blog.csdnimg.cn/img_convert/50934a76ae13a405b884f4a7a020758b.png)
安装zabbix服务器以及代理
yum install zabbix-server-mysql zabbix-agent centos-release-scl zabbix-webmysql-scl zabbix-apache-conf-scl mariadb mariadb-server -y --skip-broken
安装数据库
yum install -y mariadb-server mariadb #安装数据库
systemctl start mariadb #启动数据库
systemctl enable mariadb #设置数据库自启动
配置数据库
create database zabbix character set utf8 collate utf8_bin;
#创建名为zabbix的数据库,并设置编码模式为utf8
grant all on zabbix.* to zabbix@localhost identified by '12345';
#在数据库中创建zabbix用户,密码为12345
flush privileges; #刷新数据库数据
show databases; #查看zabbix数据库是否创建成功
quit; #退出数据库
![](https://img-blog.csdnimg.cn/img_convert/fa054fedccd230ec0e17cf18d83db53a.png)
导入初始模式和数据
zcat /usr/share/doc/zabbix-server-mysql-5.0.30/create.sql.gz | mysql -uzabbix -p'12345' zabbix
编辑文件 /etc/zabbix/zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf
修改内容如下:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=12345
为zabbix配置php,修改时区,如果没有找到这个目录请重复步骤五,可能是安装的时候漏安装了
vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
#修改内容:php_value[date.timezone] = Asia/Shanghai
![](https://img-blog.csdnimg.cn/img_convert/f42337e9564c2ef05e8219bbf4eb4991.png)
启动zabbix
systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
浏览器访问zabbix:http://server-ip/zabbix
![](https://img-blog.csdnimg.cn/img_convert/05f16a7d022666e178d2c3839d7585fe.png)
![](https://img-blog.csdnimg.cn/img_convert/68c47a9924a785e0f6f9444b0df705b2.png)
连接数据库,输入用户密码以及数据库名
![](https://img-blog.csdnimg.cn/img_convert/a253fb20b68b9b2568ba6b9c6e9a29b0.png)
![](https://img-blog.csdnimg.cn/img_convert/bd0fb2a7c1dc8f60db7a07d554df384e.png)
![](https://img-blog.csdnimg.cn/img_convert/15ca376db680364f8397600e617724ff.png)
修改成中文模式
![](https://img-blog.csdnimg.cn/img_convert/0b1cced6f9e8dd6ca421dbddcd95ddeb.png)
解决web中文乱码问题
![](https://img-blog.csdnimg.cn/img_convert/94c4b3a8f2404f871716ffcedc4f24bc.png)
yum -y install wqy-microhei-fonts
\cp -f /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
![](https://img-blog.csdnimg.cn/img_convert/5a49fcb40abcb0f173616eb4e7d3bbc8.png)