centos7.9安裝zabbix5.0.14及配置過程
一、基礎(chǔ)環(huán)境配置
1、關(guān)閉firewalld、關(guān)閉selinux
##關(guān)閉firewalld systemctl stop firewalld systemctl disabled firewalld ##關(guān)閉selinux setenforce 0 && sed -i.bak 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
2、配置yum倉(cāng)庫(kù)
配置zabbix倉(cāng)庫(kù)
wget https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm yum install zabbix-release-5.0-1.el7.noarch.rpm ##在/etc/yum.repos.d/中查看zabbix倉(cāng)庫(kù)的配置情況 [root@localhost opt]# cat /etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-frontend] name=Zabbix Official Repository frontend - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/frontend enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-debuginfo] name=Zabbix Official Repository debuginfo - $basearch baseurl=http://repo.zabbix.com/zabbix/5.0/rhel/7/$basearch/debuginfo/ enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 gpgcheck=1 [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1
配置mysql倉(cāng)庫(kù)(zabbix監(jiān)控后臺(tái)需要用到mysql存儲(chǔ))
##使用清華大學(xué)的鏡像倉(cāng)庫(kù) [root@localhost opt]# cat /etc/yum.repos.d/mysql.repo [mysql] name=mysql baseurl=https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-5.7-community-el7-x86_64/ gpgcheck=0 enabled=1
配置centos extras倉(cāng)庫(kù)(后續(xù)的安裝需要用到此倉(cāng)庫(kù)的軟件包)
[root@localhost opt]# cat /etc/yum.repos.d/centos-extras.repo [centos-extras] name=centos-extras baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7.9.2009/extras/x86_64/ enabled=1 gpgcheck=0
二、安裝數(shù)據(jù)庫(kù)
yum install mysql-community-server
啟動(dòng)mysql服務(wù)
systemctl start mysql systemctl enable mysql
在服務(wù)器初始啟動(dòng)時(shí),會(huì)發(fā)生以下情況:
服務(wù)器初始化。
SSL 證書和密鑰文件在數(shù)據(jù)目錄中生成。
validate_password 已安裝并啟用。
‘root'@'localhost創(chuàng)建了 一個(gè)超級(jí)用戶帳戶。超級(jí)用戶的密碼已設(shè)置并存儲(chǔ)在錯(cuò)誤日志文件中。要顯示它,請(qǐng)使用以下命令:
[root@localhost opt]# grep 'temporary password' /var/log/mysqld.log 2021-08-16T08:00:40.185610Z 1 [Note] A temporary password is generated for root@localhost: r8EaYzX_Xper
通過使用生成的臨時(shí)密碼登錄并為超級(jí)用戶帳戶設(shè)置自定義密碼,盡快更改 root 密碼:
[root@localhost opt]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 702 Server version: 5.7.35 MySQL Community Server (GPL) Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxxxxxx';
注意:
validate_password 默認(rèn)安裝。執(zhí)行的默認(rèn)密碼策略validate_password要求密碼至少包含1個(gè)大寫字母、1個(gè)小寫字母、1個(gè)數(shù)字和1個(gè)特殊字符,并且密碼總長(zhǎng)度至少為8個(gè)字符。
修改一下mysql的配置文件,提高其性能
[root@centos7 ~]# vim /etc/my.cnf [mysqld] //在[mysqld]下面添加下面兩行 skip_name_resolve =ON innodb_file_per_table=ON
三、安裝zabbix相關(guān)組件
1、安裝zabbix-server
安裝zabbix-server和zabbix-agent
yum install zabbix-server-mysql zabbix-agent
安裝zabbix-get命令行工具(用于后期在客戶端部署angent是測(cè)試監(jiān)控項(xiàng)使用)
yum install zabbix-get
2、安裝frontend
啟用Red Hat Software Collections(方便安裝依賴包)
##這個(gè)軟件包在centos-extras倉(cāng)庫(kù)中,所以之前配置了centos-extras倉(cāng)庫(kù) yum install centos-release-scl
編輯配置文件 /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend] ... enabled=1 ...
安裝Zabbix frontend packages
yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
安裝frontend時(shí)報(bào)錯(cuò)
提示需要rh-php72-php-fpm,rh-nginx116-nginx等軟件包。
解決方法:
因?yàn)橹皼]有安裝centos-release-scl,所以導(dǎo)致出現(xiàn)上述問題,配置好centos-extras倉(cāng)庫(kù)后安裝即可
3.創(chuàng)建初始數(shù)據(jù)庫(kù)
# mysql -uroot -pxxxxx mysql> create database zabbix character set utf8 collate utf8_bin; mysql> create user zabbix@localhost identified by 'xxxxxxx'; mysql> grant all privileges on zabbix.* to zabbix@localhost; mysql> quit;
導(dǎo)入初始架構(gòu)和數(shù)據(jù),系統(tǒng)將提示您輸入新創(chuàng)建的密碼。
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
4.為Zabbix server配置數(shù)據(jù)庫(kù)
編輯配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=xxxxxxx
5.為Zabbix前端配置PHP
編輯配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
##取消這兩行注釋
listen 80;
server_name example.com;
##同時(shí)把提供默認(rèn)的web服務(wù)的配置注釋掉
vim /etc/opt/rh/rh-nginx116/nginx/nginx.conf
...
server {
#listen 80 default_server;
#listen [::]:80 default_server;
server_name _;
...
##然后重啟服務(wù)
編輯配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, 在listen.acl_users指令這一行添加nginx用戶(在安裝rh-nginx116-nginx時(shí)系統(tǒng)會(huì)自動(dòng)創(chuàng)建)
listen.acl_users = apache,nginx ##然后配置時(shí)區(qū) php_value[date.timezone] = Asia/Shanghai
6.啟動(dòng)zabbix server和agent進(jìn)程,并為它們?cè)O(shè)置開機(jī)自啟。
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
四、配置Zabbix前端
在瀏覽器中 打開 Zabbix 前端URL:
對(duì)于 Apache:http://<server_ip_or_name>/zabbix
對(duì)于 Nginx:http://<server_ip_or_name>

檢查先決條件
確保滿足所有軟件先決條件。

注意:如果需要更改Apache用戶或用戶組,則必須驗(yàn)證對(duì)會(huì)話文件夾的權(quán)限。否則 Zabbix 安裝程序可能無法繼續(xù)。
配置數(shù)據(jù)庫(kù)連接
輸入連接到數(shù)據(jù)庫(kù)的詳細(xì)信息。Zabbix 數(shù)據(jù)庫(kù)必須已經(jīng)創(chuàng)建

Zabbix 服務(wù)器詳細(xì)信息
輸入 Zabbix 服務(wù)器詳細(xì)信息。輸入 Zabbix 服務(wù)器的名稱是可選的

查看設(shè)置摘要。

安裝完成

登錄
Zabbix 前端已準(zhǔn)備就緒!默認(rèn)用戶名為Admin,密碼為zabbix。


到此這篇關(guān)于centos7.9安裝zabbix5.0.14及配置過程的文章就介紹到這了,更多相關(guān)centos7.9安裝zabbix內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來,僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信