要完成離線安裝需要先準(zhǔn)備一臺與離線服務(wù)器裝有相同操作系統(tǒng)的電腦聯(lián)網(wǎng)下載安裝包澄惊。
1、登陸zabbix官網(wǎng)富雅,選擇要安裝的zabbix版本掸驱。地址:https://www.zabbix.com/cn/download?zabbix=4.4&os_distribution=centos&os_version=8&db=mysql&ws=nginx。這里我們選擇zabbix4.4版本没佑, CentOS8亭敢、mysql數(shù)據(jù)庫、Nignx图筹。
2、用能上網(wǎng)的主機(jī)下載安裝包
參考官網(wǎng)安裝步驟:
用能上網(wǎng)的主機(jī)安裝zabbix-release-4.4-1.el8.noarch.rpm让腹,下載對應(yīng)的安裝包远剩。在執(zhí)行rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm進(jìn)行安裝時如果碰上網(wǎng)絡(luò)不好會出現(xiàn)以下情況:
這時我們可以考慮使用國內(nèi)的鏡像進(jìn)行安裝,這里采用阿里云的鏡像骇窍。步驟如下:
1)rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
2)因為我們是通過阿里云鏡像進(jìn)行下載瓜晤,此處需要修改此次下載使用的軟件倉庫文件,地址/etc/yum.repos.d路徑下zabbix.repo文件腹纳,需要修改為阿里云的鏡像地址痢掠,具體修改如下:
3)在/root目錄下創(chuàng)建zabbix目錄(因為我使用的root用戶進(jìn)行安裝驱犹,如果選用其它用戶可以自己定義下載路徑),存放下載的安裝包足画。
mkdir zabbix?
通過dnf命令下載對應(yīng)的安裝包雄驹,此處只下載不安裝,指定的下載路徑為/root/zabbix
dnf install --downloadonly --downloaddir=/root/zabbix zabbix-server-mysql zabbix-web-mysql zabbix-nginx-conf zabbix-agent
4)執(zhí)行成功后zabbix目錄下會下載27個.rpm結(jié)尾的安裝文件淹辞,把這些文件拷貝到需要離網(wǎng)的服務(wù)器医舆。
5)在最終的離網(wǎng)服務(wù)器上安裝zabbix4.4.登錄到安裝文件目錄執(zhí)行安裝命令。
rpm -Uvh ***.rpm??#其中U表示更新象缀,v表示顯示安裝過程蔬将,h表示顯示進(jìn)度
6)在mysql數(shù)據(jù)庫上創(chuàng)建zabbix用戶和zabbix數(shù)據(jù)庫并導(dǎo)入數(shù)據(jù)。
創(chuàng)建zabbix用戶
create user 'zabbix'@'localhost' identified by '123456zabbix';
為zabbix用戶賦權(quán)央星,zabbix用戶對所有數(shù)據(jù)庫中文件可以做任何操作
grant all privileges? on *.*? to "zabbix"@'localhost';
創(chuàng)建zabbix數(shù)據(jù)庫霞怀,此處一定要指定utf8字符集,而且必須是utf8字符集莉给,如果是別的字符集在配置zabbix的時候肯定要報錯毙石。
create database zabbix character set utf8 collate utf8_bin;
向zabbix數(shù)據(jù)庫導(dǎo)入數(shù)據(jù),執(zhí)行以下命令:
zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p
此處肯定會出現(xiàn)以下錯誤:
這里需要通過vim命令修改create.sql.gz文件禁谦。執(zhí)行以下命令:
vim /usr/share/doc/zabbix-server-mysql/create.sql.gz
在打開的文件中點(diǎn)擊"i"鍵胁黑,在文件的最上面插入use zabbix;。然后點(diǎn)擊esc鍵州泊,:wq!保存退出丧蘸。此處就是在加載數(shù)據(jù)文件的時候首先切換到zabbix數(shù)據(jù)庫。然后再執(zhí)行zcat /usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql -u zabbix -p命令遥皂,加載數(shù)據(jù)力喷。最后會在zabbix數(shù)據(jù)庫離創(chuàng)建149個表的數(shù)據(jù)。
導(dǎo)入數(shù)據(jù)時如果出現(xiàn)以下錯誤:
ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)
需要登錄數(shù)據(jù)庫執(zhí)行:
ALTER USER 'zabbix'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456zabbix';
賦予本地訪問權(quán)限演训。
參考官網(wǎng)安裝步驟:
7)為Zabbix server配置數(shù)據(jù)庫弟孟。執(zhí)行以下命令
vi /etc/zabbix/zabbix_server.conf
8)修改nginx配置文件,為Zabbix前端配置PHP
修改/etc/nginx目錄下的nginx.conf文件样悟,修改方法就是用/etc/nginx/conf.d/zabbix.conf文件中的內(nèi)容替換/etc/nginx/nginx.conf文件中server括號內(nèi)的內(nèi)容拂募。
vi /etc/nginx/nginx.conf
要將listen和server_name前面的注釋刪掉。
9)編輯配置文件 /etc/php-fpm.d/zabbix.conf,修改時區(qū)窟她,前面的“;”一定要去掉陈症。中國只能改為Asia/Shanghai,不能是Asia/Beijing。 ??
10)關(guān)閉SElinux震糖,firewalld,具體的執(zhí)行命令參考以下信息:
#查看selinux狀態(tài)
[root@localhost zabbix]# getenforce
Enforcing? #開啟狀態(tài)
#設(shè)置selinux為被動模式
[root@localhost zabbix]# setenforce 0
[root@localhost zabbix]# getenforce
Permissive? #被動模式
[root@localhost zabbix]# vi /etc/selinux/config
SELINUX=disable
#查看firewall是否開機(jī)啟動
[root@localhost zabbix]# systemctl list-unit-files | grep fire
firewalld.service? ? ? ? ? ? ? ? ? ? ? ? ? enabled
#查看firewall是否正在運(yùn)行
[root@localhost zabbix]# systemctl status firewalld.service
[root@localhost zabbix]# systemctl list-units | grep fire
#停掉firewall录肯,并禁止開機(jī)啟動
[root@localhost zabbix]# systemctl stop firewalld.service
[root@localhost zabbix]# systemctl disable firewalld.service
11)啟動zabbix進(jìn)程
systemctl restart zabbix-server zabbix-agent nginx php-fpm
設(shè)置為開機(jī)啟動
systemctl enable zabbix-server zabbix-agent nginx php-fpm
如果啟動失敗肯定是SElinux,firewalld沒有關(guān)閉的原因吊说,檢查是否關(guān)閉论咏。
12)通過前端頁面進(jìn)行zabbix設(shè)置优炬,訪問http://localhost/setup.php地址。
數(shù)據(jù)庫設(shè)置界面需要輸入zabbix用戶的密碼厅贪,同時容易出現(xiàn)字符集錯誤蠢护,所以創(chuàng)建的zabbix數(shù)據(jù)庫必須使用SET utf8 COLLATE utf8_bin;如果設(shè)置錯誤,數(shù)據(jù)導(dǎo)入后再修改字符集也會報錯卦溢,只能刪除數(shù)據(jù)庫重新創(chuàng)建糊余。所以一定要保證使用的字符集正確。
數(shù)據(jù)庫設(shè)置時還需要在數(shù)據(jù)庫中執(zhí)行以下ALTER USER 'zabbix_username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'zabbix_password';(需要修改對應(yīng)的用戶名和密碼)单寂,這樣zabbix服務(wù)才能在本地訪問mysql數(shù)據(jù)庫贬芥。
數(shù)據(jù)庫配置可能出現(xiàn)以下問題,如果日志/var/log/zabbix/zabbix_server.log中看到以下錯誤
肯定是導(dǎo)入數(shù)據(jù)表有問題宣决,實際操作中出現(xiàn)過導(dǎo)入表數(shù)量沒問題蘸劈,但是表無法打開的問題。需要重新執(zhí)行表導(dǎo)入操作尊沸。
以下錯誤可以通過再次修改密碼解決
query failed: [1053] Server shutdown in progress [select taskid,type,clock,ttl from task where status in (1,2) order by taskid]
? 7039:20200915:204305.347 [Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
通過Admin/zabbix 用戶名/密碼登錄系統(tǒng)威沫。
安裝完成!
問題:
10258:20201105:044732.399 __mem_malloc: skipped 4 asked 6296 skip_min 352 skip_max 5840
10258:20201105:044732.399 [file:dbconfig.c,line:94] __zbx_mem_realloc(): out of memory (requested 6296 bytes)
10258:20201105:044732.399 [file:dbconfig.c,line:94] __zbx_mem_realloc(): please increase CacheSize configuration parameter
10258:20201105:044732.399 === memory statistics for configuration cache ===
解決方法:
找到zabbix_server.conf文件
在zabbix_server.conf文件搜索CacheSize=8M或者VMwareCacheSize=8M洼专,將其修改為CacheSize=1024M
重啟:
systemctl restart zabbix-server zabbix-agent nginx php-fpm
參考摘錄文檔:
https://www.zabbix.com/download?zabbix=4.4&os_distribution=centos&os_version=8&db=mysql&ws=nginx
https://www.cnblogs.com/forlive/p/9358605.html
https://blog.csdn.net/yulei_qq/article/details/83713472
https://www.cnblogs.com/opsprobe/p/10812274.html
https://www.cnblogs.com/wangyueping/p/11258028.html
https://blog.csdn.net/u013948852/article/details/99842484
https://blog.csdn.net/zhaowenzhong/article/details/83753946
https://www.cnblogs.com/wangyueping/p/11258028.html
https://www.cnblogs.com/will--1213/p/11824550.html
https://blog.csdn.net/abcdu1/article/details/89471790
zabbix圖形展現(xiàn)中文亂碼解決方法
https://blog.csdn.net/qq43748322/article/details/85676511
上傳的字體可以隨便放一個目錄內(nèi)棒掠,指定的位置正確就可以