关闭防火墙和文件防火墙
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 #生成缓存

修改zabbix源篇日志(开启安装源)
vi /etc/yum.repos.d/zabbix.repo
找到zabbix-frontend 把enable改成1 #开启安装源

安装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; #退出数据库

导入初始模式和数据
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

启动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


连接数据库,输入用户密码以及数据库名



修改成中文模式

解决web中文乱码问题

yum -y install wqy-microhei-fonts
\cp -f /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
