CentOS8.5下安装部署开源监控系统Zabbix 6.0LTS
一、 CentOS8.5操作系统初始环境准备
Centos8于2021年年底停止了服务,在使用yum源安装时候会出现下面错误
代码语言:javascript复制错误:Failed to download metadata for repo ‘AppStream’: Cannot prepare internal mirrorlist: No URLs in mirrorlist”
解决办法
- 1、替换成vault源
cd /etc/yum.repos.d/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
- 2、更新yum源为镜像源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum clean all
yum makecache
截图略
下面参考Zabbix官方安装向导说明文档进行安装部署
(图片可点击放大查看)
二、安装MySQL8.0
代码语言:javascript复制dnf install mysql-server
(图片可点击放大查看)
代码语言:javascript复制vim /etc/my.cnf.d/charset.cnf
cat /etc/my.cnf.d/charset.cnf
# set default charaset
# for the case of 4 bytes UTF-8, specify [utf8mb4]
[mysqld]
character-set-server = utf8mb4
systemctl enable --now mysqld
(图片可点击放大查看)
代码语言:javascript复制systemctl restart mysqld
mysql_secure_installation
(图片可点击放大查看)
(图片可点击放大查看)
设置MySQL root用户可以远程登录
代码语言:javascript复制firewall-cmd --add-service=mysql --permanent
firewall-cmd --reload
代码语言:javascript复制mysql -uroot -p -h 127.0.0.1
use mysql;
update user set host= '%' where user = 'root';
flush privileges;
(图片可点击放大查看)
最后验证远程登录
代码语言:javascript复制mysql -uroot -p -h 192.168.31.47
三、安装Zabbix6.0
代码语言:javascript复制rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/8/x86_64/zabbix-release-6.0-1.el8.noarch.rpm
dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent
(图片可点击放大查看)
四、zabbix数据库初始化
代码语言:javascript复制mysql -uroot -p
create database zabbix character set utf8mb4 collate utf8mb4_bin;
create user zabbix@'%' identified by 'Zabbix@2022';
grant all privileges on zabbix.* to zabbix@'%';
(图片可点击放大查看)
代码语言:javascript复制zcat /usr/share/doc/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix
vim /etc/zabbix/zabbix_server.conf
cat /etc/zabbix/zabbix_server.conf | grep DBPassword
#配置文件中填入数据库密码
DBPassword= Zabbix@2022
(图片可点击放大查看)
五、启动Zabbix-Server及相关组件
- 1、编辑配置文件 /etc/nginx/conf.d/zabbix.conf, 取消如下两行的注释
vi /etc/nginx/conf.d/zabbix.conf
listen 80;
# server_name zabbix.walkingcloud.cn;
- 2、/etc/nginx/nginx.conf 中下面一段注释掉后重启nginx服务
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /usr/share/nginx/html;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
(图片可点击放大查看)
(图片可点击放大查看)
- 3、启动服务
systemctl restart zabbix-server zabbix-agent nginx php-fpm
systemctl enable zabbix-server zabbix-agent nginx php-fpm
firewall-cmd --permanent --zone=public --add-port=80/tcp
firewall-cmd --permanent --zone=public --add-port=10051/tcp
firewall-cmd --permanent --zone=public --add-port=10050/tcp
firewall-cmd --reload
(图片可点击放大查看)
六、Zabbix Web界面初始化
(图片可点击放大查看)
(图片可点击放大查看)
(图片可点击放大查看)
(图片可点击放大查看)
Tips
1、语言包问题
解决办法:
(图片可点击放大查看)
代码语言:javascript复制dnf install langpacks-zh_CN.noarch
(图片可点击放大查看)
(图片可点击放大查看)
2、图形乱码问题
(图片可点击放大查看)
代码语言:javascript复制 cd /usr/share/zabbix/assets/fonts/
ll /etc/alternatives/zabbix-web-font
cd /usr/share/fonts/dejavu/
mv DejaVuSans.ttf DejaVuSans.ttf_bak
Windows系统中找到msyh.ttc字体文件上传
mv msyh.ttc DejaVuSans.ttf
(图片可点击放大查看)
(图片可点击放大查看)
以上就是Zabbix6.0LTS的版本的部署
之前也有介绍过Zabbix4.0老版本的部署
CentOS7下Zabbix监控平台的搭建
CentOS7下部署Zabbix4.0
CentOS7下Zabbix5.0 PostgreSQL12 TimescaleDB部署实践
(图片可点击放大查看)