Zabbix 它是一个优秀的企业级分布式开源监控解决方案。官网下载页面操作系统平台没有国产操作系统,但如果要求国产操作系统在实际生产环境中使用,我们该怎么办?Anolisolis阿里龙蜥操作系统 OS 8与RHEL 8系统是兼容的,所以此次我们尝试在Anolisolis阿里龙蜥操作系统 OS Zabbix8.9上部署 7.0 LTS,操作系统是以最小化的方式安装的,如图1所示,下面将详细介绍安装过程。

图1 Anolis最小化安装 OS 8.9操作系统
首先,点击Zabbix下载并安装在Zabbix官网页面,然后根据图2显示选择平台操作系统、数据库软件和web服务器。图3是官网指导安装教程。

图2 选择Zabbix安装平台

图3 Zabbix安装指导步骤
首先安装Zabbix仓库源,如图4所示,命令如下:
# rpm -Uvh https://repo.zabbix.com/zabbix/7.0/rocky/8/x86_64/zabbix-release-7.0-1.el8.noarch.rpm# dnf clean all

图4 安装Zabbix仓库源库
下一步选择PHP模块版本,如图5所示,相应的命令如下:
# dnf module switch-to php:8.0

图5 切换PHP模块版本
然后安装Zabbix server,Web前端,Zabbix agent,如图6所示,命令为:
# dnf install zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-sql-scripts zabbix-selinux-policy zabbix-agent

图6 安装Zabbix server,Web前端,Zabbix agent
由于公钥导入失败,安装失败。如图7所示,我们可以修改zabbix仓库源的repo文件,而不需要公钥验证。使用vi编辑zabbix.repo文件,命令如下,将gpgcheck=1修改为gpgcheck=0,如图8所示。
vi /etc/yum.repo.d/zabbix.repo

图7 由于公钥未导入,安装软件失败。

图8 修改zabbix.repo没有进行验证检查。
重新安装Zabbix server,Web前端,Zabbix 如图9所示,agent的命令,程序的成功安装。

图9 Zabbix相关程序安装成功
因为Zabbix 7.0 mariadb数据库软件版本的LTS版本要求高于或等于10.5,Anolis OS 默认情况下,8.9系统为10.3,因此需要更改mariadb数据库的版本为10.5,如图10所示,命令为:
#dnf module enable mariadb:10.5#dnf install mariadb-server

图10 切换数据库版本的mariadb和安装数据库
然后启动mariadb数据库服务器,并将数据库服务添加到系统中,然后检查mariadb服务的当前状态,如图11所示,命令为:
# systemctl enable mariadb# systemctl start maridb# systemctl status maridb

图116 启动mariadb server服务
使用mysql_secure如图12所示,_installation命令初始化mariadb并配置root密码。

图12 Mariadb初始化管理员密码
使用mariadb数据库root用户进入mariadb,并建立zabbix数据库,如图13所示,其中zabbix数据库的密码是自己设置的,这里设置为zabbix,建议在生产环境中使用强度复杂的密码,相应的配置命令如下:
# mysql -uroot -ppasswordmysql> create database zabbix character set utf8mb4 collate 8mb4utf_bin;mysql> create user zabbix@localhost identified by 'zabbix';mysql> grant all PRivileges on zabbix.* to zabbix@localhost;mysql> set global log_bin_trust_function_creators = 1;mysql> quit;

图13 创建zabbix数据库
导入初始架构和数据,系统会提示您输入新创建的密码,如图14所示。这里的导入时间比较长,耐心等待,命令如下:
# zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix

图14 初始表导入zabbix数据库。
log__禁用log_bin_trust_function_creators 如图15所示,选项的命令是:
# mysql -uroot -pmysql> set global log_bin_trust_function_creators = 0;mysql> quit;

图15 log__禁用log_bin_trust_function_creators 选项
使用vi编辑器编辑/etc/zabbix/zabbix_server.修改DBPasswordddonf配置文件=zabbix,如图16所示。

图16 修改zabbix server配置文件
编辑///使用vi编辑器etc/nginx/conf.d/zabbix.如图17所示,conf配置文件配置端口号和服务器IP地址。

图17 修改Nginx配置文件
启动Zabbix server和agent进程,并且为它们设置启动自启动,命令如下:
# systemctl restart zabbix-server zabbix-agent nginx php-fpm# systemctl enable zabbix-server zabbix-agent nginx php-fpm

图18
这里完成了zabbix的安装,在配置之前,我们需要检查zabbix-server、mariadb、php-fpm和nginx服务状态:

图19 zabbix-正常的server服务

图20 正常的mariadb服务

图21 php-正常的fpm服务

图22 正常的nginx服务
因为默认情况下,系统已经打开了防火墙,如图23所示,所以我们需要设置nginx服务的80端口、zabbix服务的10050端口和10051端口的放行策略,它的命令如下:
#firewall-cmd --PErmanent --add-port=80/tcp#firewall-cmd --permanent --add-port=10050/tcp#firewall-cmd --permanent --add-port=10051/tcp#firewall-cmd --reload

图23 默认情况下,防火墙服务是打开的。

图24 配置防火墙策略
到目前为止,我们可以在谷歌浏览器地址栏输入新配置的服务器IP地址,通常会出现zabbix。 在web端安装界面,选择中文安装,如图25所示。

图25 登录zabbx安装初始界面
确保所有项目都正确,然后点击下一步,如图26所示。

图26 检查zabbix 必要的web端条件
配置数据库连接,输入前面设置的zabbix数据库的用户和密码,点击下一步继续安装,如图27所示。

图27 配置数据库连接
如图28所示,配置Zabbix的主机名称。

图28 Zabbix主机名称设置
Zabbix 7.0 LTS 在安装web端之前,点击下一步,继续,如图29所示。

图29 安装前总结界面
如图30所示,完成Zabbix的安装。

图30 Zabbix 完成web安装
重新访问zabbix的web界面,输入IP地址和端口,然后使用初始帐户和密码登录,初始帐户为:Admin,密码为:zabbix 如图31所示。

图31 登录界面zabbix
到目前为止,Zabbix已经成功安装 7.0 LTS,如图32所示。

图32 Zabbix 7.0 LTS
因为openEuler社区在写这篇文章之前比较活跃,所以在openEuler社区尝试过。 22.03 Zabbix安装LTS操作系统 7.0 LTS,但是因为openEuler 22.03 由于没有更新LTS库文件,Zabbix无法安装。 server,在openEuler 24.03 Zabbix安装在LTS上。 7.0 LTS,结果报告同样的错误,最后找出原因,发现库文件在两个系统发行版本中都是一样的。这一次,Zabbix被重新安装在龙蜥操作系统上。 7.0 LTS,这是为了满足一个网民的需要。
创作并不容易,如果觉得对你有帮助,请关注并转发!
发表评论