官网地址 https://www.zabbix.com/cn/download?zabbix=6.2&os_distribution=centos&os_version=8&components=server_frontend_agent&db=mysql&ws=apache 关闭防火墙和SELINUX安全模式 #关闭防火墙并设置开机不启动 [root@zabbix-server ~]# systemctl disable firewalld Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. systemctl stop firewalld 关闭SElinux安全模式 [root@zabbix-server ~]# setenforce 0 [root@zabbix-server ~]# getenforce Permissive [root@zabbix-server ~]# vi /etc/selinux/config 修改以下内容: SELINUX=disabled 按:wq保存退出即可。重启生效。 sed命令关闭selinux sed -i "/SELINUX/s/enforcing/disabled/" /etc/selinux/config sed -i "/SELINUX/s/targeted/disabled/" /etc/selinux/config grep "SELINUX" /etc/selinux/config # SELINUX= can take one of these three values: SELINUX=disabled # SELINUXTYPE= can take one of three values: SELINUXTYPE=disabled [root@zabbix-server ~]# reboot 添加yum 软件仓库 删除centos8 /etc/yum.repos.d/目录下的所有yum源。 cd /etc/yum.repos.d/ && rm -rf *repo 安装软件仓库配置包,这个包包含了 yum(软件包管理器)的配置文件。 # curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo # yum clean all添加 Zabbix 软件仓库 安装软件仓库配置包,这个包包含了 yum(软件包管理器)的配置文件。 # rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm # yum clean all 切换PHP版本 # dnf module switch-to php:7.4 安装Zabbix server,Web前端,agent # dnf install zabbix-server-mysql zabbix-web-mysql zabbix-apache-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent 创建初始数据库 在数据库主机上运行以下代码。 # mysql -uroot -p password mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin; mysql> create user zabbix@localhost identified by "password"; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> set global log_bin_trust_function_creators = 1; mysql> quit; 导入初始架构和数据,系统将提示您输入新创建的密码。 # zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix Disable log_bin_trust_function_creators option after importing database schema. # mysql -uroot -p password mysql> set global log_bin_trust_function_creators = 0; mysql> quit;为Zabbix server配置数据库 编辑配置文件 /etc/zabbix/zabbix_server.conf DBPassword=password启动Zabbix server和agent进程 启动Zabbix server和agent进程,并为它们设置开机自启: # systemctl restart zabbix-server zabbix-agent httpd php-fpm # systemctl enable zabbix-server zabbix-agent httpd php-fpm配置zabbix前端 图表中文乱码 在修改为简体中文后,监控图表中有些中文字符会显示乱码,可以安装中文字体来解决 [root@localhost ~]# yum -y install wqy-microhei-fonts [root@localhost ~]# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf 重启zabbix-server和apache使配置生效 [root@localhost ~]# systemctl restart zabbix-server [root@localhost ~]# systemctl restart httpd 重新登录即可 至此Zabbix server则安装成功,