1. 程式人生 > 實用技巧 >zabbix 生產環境安裝

zabbix 生產環境安裝

  1. 配置zabbix yum 倉庫    
[root@zkxh-huawei /]#  mkdir soft
[root@zkxh-huawei /]# cd soft/
[root@zkxh-huawei /]# wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
[root@zkxh-huawei /]#  rpm -ivh zabbix-release-4.4-1.el7.noarch.rpm

[root@zkxh-huawei /]#cat /etc/yum.repos.d/zabbix.repo

  # zabbix.repo內容如下

[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
​
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch 
baseurl=https://mirror.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

  2.安裝zabbix服務端和zabbix-web前端

[root@zkxh-huawei /]# yum install zabbix-server-mysql zabbix-web-mysql  -y

  3. 安裝mariadb, 建立zabbix庫,授權zabbix使用者  

[root@zkxh-huawei /]# yum install mariadb-server -y
[root@zkxh-huawei /]# systemctl start mariadb
[root@zkxh-huawei /]# systemctl enable mariadb
[root@zkxh-huawei /]# mysql_secure_installation
#回車
#n
#一路y
[root@zkxh-huawei /]# mysql #進入
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
#匯入zabbix表結構和初始資料 
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix

  #檢查zabbix庫是否匯入成功:

[root@zkxh-huawei /]# mysql -uroot  zabbix -e 'show tables'

  

  4. 配置啟動 zabbix-server

[root@zkxh-huawei /]# vim /etc/zabbix/zabbix_server.conf 
             DBHost=localhost 
            DBName=zabbix
            DBUser=zabbix
            DBPassword=123456
#啟動zabbix-server
[root@zkxh-huawei /]# systemctl start zabbix-server
[root@zkxh-huawei /]# systemctl enable zabbix-server
#檢查:
[root@zkxh-huawei /]# netstat -lntup

  

  5. 修改zabbix前端的配置,並啟動httpd

[root@zkxh-huawei /]# vim /etc/httpd/conf.d/zabbix.conf 

  

[root@zkxh-huawei /]# systemctl start httpd
[root@zkxh-huawei /]# systemctl enable httpd
[root@zkxh-huawei /]# systemctl status httpd

  6. 前端zabbix-web安裝 

# 瀏覽器:http://127.0.0.1/zabbix
# 後期修改zabbix資料庫密碼的時候,需要修改的配置檔案:
# [root@zkxh-huawei /]# /etc/zabbix/web/zabbix.conf.php
​
# http://127.0.0.1/zabbix/zabbix.php
# 登入的賬號密碼;
# Admin
# zabbix