环境要求:
1、Server: 192.168.3.81 监控主机
2、Agent:192.168.3.82 监控客户端
系统要求:Rockylinux8.6
一、yum 安装(zabbix+nginx+mariadb)
1、关闭selinux,firewalld
1、sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/g’ /etc/selinux/config
2、systemctl disable firewalld
3、reboot
2、更改yum源为阿里云
sed -e ‘s|^mirrorlist=|#mirrorlist=|g’
-e ‘s|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=https://mirrors.aliyun.com/rockylinux|g’
-i.bak
/etc/yum.repos.d/Rocky-*.repo
dnf makecache
vim /etc/yum.repos.d/Rocky-AppStream.repo
添加
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos8-amd64
module_hotfixes=1
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
3、配置命令补全及vim工具
dnf install -y wget bash-completion vim net-tools
dnf update -y
4、安装zabbix源
rpm -Uvh https://repo.zabbix.com/zabbix/6.2/rhel/8/x86_64/zabbix-release-6.2-3.el8.noarch.rpm
dnf clean all
5、安装php及zabbix
dnf module switch-to php:7.4
dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
6、安装mariadb(10.5.18)
dnf install -y mariadb-server
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
设置数据库密码为:password
注:不支持 10.5以下版本
7、初始化数据库
mysql -uroot -ppassword
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@localhost identified by ‘password’;
grant all privileges on zabbix.* to zabbix@localhost;
set global log_bin_trust_function_creators = 1;
quit;
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
mysql -uroot -ppassword
set global log_bin_trust_function_creators = 0;
quit;
8、编辑配置文件
yum -y install vim
vim /etc/zabbix/zabbix_server.conf
将129行改为
DBPassword= password
vim /etc/nginx/conf.d/zabbix.conf
将前两行改为
listen 8080;
server_name 192.168.3.81;
9、安装中文包
1、dnf install langpacks-zh_CN.noarch # 安装zh_CN语言包
2、dnf -y install glibc-common # 安装glibc-common实现对语言包的识别
3、locale -a | grep zh_CN
zh_CN
zh_CN.gb18030
zh_CN.gbk
zh_CN.utf8
10. 启动服务并设置开机自启
1、systemctl restart zabbix-server zabbix-agent nginx php-fpm
2、systemctl enable zabbix-server zabbix-agent nginx php-fpm
11.访问页面
http://ip:8080/
账号:Admin 密码:zabbix
12、Zabbix 6.0 Web界面中文汉化
将字体文件拷贝到Fonts路径下备份和替换字体:
mv graphfont.ttf graphfont.ttf.bak
mv msyhbd.ttc graphfont.ttf