1. 程式人生 > 其它 >zabbix5.X部署

zabbix5.X部署

前言

作業系統為Centos

[root@ops ~]# uname -a
Linux ops.cluster105.cc 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@ops ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

部署zabbix

部署zabbix源

rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all yum makecheck
 1 [root@ops ~]# cat /etc/yum.repos.d/zabbix.repo 
 2 [zabbix]
 3 name=Zabbix Official Repository - $basearch
 4 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/
 5 enabled=1
 6 gpgcheck=1
 7 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
 8 
 9 [zabbix-frontend]
10 name=Zabbix Official Repository frontend - $basearch 11 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend 12 enabled=1 13 gpgcheck=1 14 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 15 16 [zabbix-debuginfo] 17 name=Zabbix Official Repository debuginfo - $basearch 18 baseurl=https://
repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/debuginfo/ 19 enabled=0 20 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 21 gpgcheck=1 22 23 [zabbix-non-supported] 24 name=Zabbix Official Repository non-supported - $basearch 25 baseurl=https://repo.huaweicloud.com/zabbix/zabbix/5.0/rhel/7/x86_64/ 26 enabled=1 27 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX 28 gpgcheck=1 29 30 31 [root@ops ~]# cd /etc/pki/rpm-gpg/ 32 [root@ops rpm-gpg]# wget https://repo.huaweicloud.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591
華為雲zabbix源

安裝zabbix

yum install zabbix-server-mysql zabbix-agent

前端安裝先決條件Zabbix前端需要額外的基本安裝包。 您需要在將執行Zabbix前端的系統中啟用可選rpms的儲存庫:

yum-config-manager --enable rhel-server-rhscl-7-rpms

vim  /etc/yum.repos.d/zabbix.repo 
[zabbix-frontend]
...
enabled=1
...

安裝前端元件

yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl

建立初始資料庫

# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@"127.0.0.1" identified by '123456';
mysql> grant all privileges on zabbix.* to zabbix@"127.0.0.1";
mysql> quit;

匯入資料庫

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

編輯配置檔案

vim /etc/zabbix/zabbix_server.conf
......
DBHost=127.0.0.1
DBName=zabbix
DBUser=zabbix
DBPassword=123456
......

配置前端及時區

vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
......
listen 80;
server_name zabbix.superops.top;
......

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
listen.acl_users = apache,nginx
php_value[date.timezone] = Asia/Shanghai

啟動程式

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
systemctl status zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm

前端操作

瀏覽器訪問

訪問地址:http://server_ip_or_name

檢查必要條件

連線資料庫

配置zabbix server 地址

安裝預覽

安裝

登入測試

使用者名稱: Admin

密碼: zabbix

作者:閆世成

出處:http://cnblogs.com/yanshicheng

聯絡:[email protected]

本文版權歸作者和部落格園共有,歡迎轉載,但未經作者同意必須保留此段宣告,且在文章頁面明顯位置給出原文連線,如有問題或建議,請多多賜教,非常感謝。