zabbix安装中文语言包及中文乱码的解决(zabbix5.0)

一,zabbix不能配置中文界面的问题:

1, zabbix5.0

系统安装后,web界面不能选择使用中文

系统提示:

You are not able to choose some of the languages, because locales for them are not installed on the web server.

截图:

2,解决问题:手动安装中文语言包:

安装zh_CN语言包

[root@blog include]# dnf install langpacks-zh_CN.noarch

安装glibc-common实现对语言包的识别:

[root@blog include]# dnf install glibc-common

说明;如果已安装过,需要重新安装,用reinstall

[root@blog include]# dnf reinstall glibc-common

因为需要让它识别已安装的语言包

测试安装是否成功?

[root@blog dejavu]# locale -a | grep zh_CN
zh_CN
zh_CN.gb18030
zh_CN.gbk
zh_CN.utf8

如果看到zh_CN语言已安装,表示成功

3,安装完成后,回到web页面,刷新

可以看到中文语言已可以选中

截图:

 

点击"update"按钮后会自动切换成中文界面 

说明:刘宏缔的架构森林是一个专注架构的博客,地址:https://www.cnblogs.com/architectforest

         对应的源码可以访问这里获取: https://github.com/liuhongdi/

说明:作者:刘宏缔 邮箱: [email protected]

二,zabbix5.0切换到中文界面后,部分在图片上显示的文字会出现中文乱码:

1,看截图:

  

问题的原因在于zabbix默认的字体文件不支持中文,所以中文字符的显示成了乱码 

2,如何解决中文乱码?

查看zabbix的web目录下include/defines.inc.php文件中对于字体的定义:

define('ZBX_FONTPATH',                          realpath('assets/fonts')); // where to search for font (GD > 2.0.18)
define('ZBX_GRAPH_FONT_NAME',           'DejaVuSans'); // font file name

可以看到zabbix使用了自己定义的字体文件,而没有使用linux的系统字体

路径位于web目录下assets/fonts目录

安装黑体:

说明:我们可以从windows的字体目录下获取黑体的字体文件,

windows下的字体文件位于:

C:\Windows\Fonts

把文件通过sftp上传到linux服务器即可,

然后复制到zabbix的web目录下assets/fonts目录

[root@blog fonts]# pwd
/data/web/zabbix/html/assets/fonts
[root@blog fonts]# cp /home/liuhongdi/fonts/simhei.ttf ./

把黑体的字体文件符号链接为zabbix的默认字体:DejaVuSans.ttf

[root@blog fonts]# ls
DejaVuSans.ttf  simhei.ttf
[root@blog fonts]# mv DejaVuSans.ttf DejaVuSans.ttf.bak
[root@blog fonts]# ln -s simhei.ttf DejaVuSans.ttf

刷新页面之后,恢复正常

看截图:

 

三,查看zabbix的版本:

[root@blog zabbix-5.0.0]# /usr/local/soft/zabbx-5.0.0/sbin/zabbix_server --version
zabbix_server (Zabbix) 5.0.0
Revision 9665d62db0 11 May 2020, compilation time: May 17 2020 09:37:03

Copyright (C) 2020 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

猜你喜欢

转载自www.cnblogs.com/architectforest/p/12911721.html