CentOS8安裝Zabbix 4.4

Zabbix介紹:

Zabbix是一個基於Web界面提供分佈式系統監視及網絡監視功能的企業級開源解決方案。它能監視各種網絡參數,保證服務器系統的安全運營,並提供靈活的通知機制以讓系統管理員快速定位/解決存在的各種問題;藉助Zabbix可很輕鬆地減輕運維人員們繁重的服務器管理任務,實現業務系統持續運行。Zabbix分爲Agent端和Server端,Agent端:主機通過安裝agent方式採集數據。Server端:通過收集agent發送的數據,寫入數據庫(MySQL,ORACLE等),再通過php+apache在web前端展示。

實戰環境:

  • Centos8_x64

  • Zabbix-4.4

安裝步驟:

一、配置操作系統

1、重命名計算機名:

[root@localhost ~]# vim /etc/hostname

2、配置 SELinux:

[root@localhost ~]# vim /etc/selinux/config

更改:

SELINUX=disabled

3、配置防火牆:爲了方便,我這裏選擇直接關閉防火牆;

[root@localhost ~]# systemctl stop firewalld.service [root@localhost ~]# systemctl disable firewalld.service

4、配置網絡:設置固定 IP 地址;​​​​​​​

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens192更改:BOOTPROTO="static"添加:IPADDR=10.10.10.50 NETMASK=255.255.255.0 GATEWAY=10.10.10.1 DNS1=10.10.10.5
重啓網絡:[root@localhost ~]# systemctl restart network

二、安裝 Zabbix 

1、更新系統:

[root@zabbix ~]# yum update -y

2、安裝必要組件:​​​​​​​

[root@zabbix ~]# dnf install -y httpd mysql-server \php php-mysqlnd php-mbstring php-pdo php-gd

3、開啓必要組件的服務:​​​​​​​

[root@zabbix ~]# systemctl enable --now httpd.service [root@zabbix ~]# systemctl enable --now mysqld.service

4、更改 HTTP 時區​​​​​​​

[root@zabbix ~]# vim /etc/php.ini# 設置:date.timezone = Asia/Shanghai

5、初始化數據:配置數據庫密碼(MySQL 的密碼)​​​​​​​

[root@zabbix ~]# mysql_secure_installation Securing the MySQL server deployment. Connecting to MySQL using a blank password.# 中間全部yVALIDATE PASSWORD COMPONENT can be used to test passwordsand improve security. It checks the strength of passwordand allows the users to set only those passwords which aresecure enough. Would you like to setup VALIDATE PASSWORD component?Press y|Y for Yes, any other key for No: yThere are three levels of password validation policy:LOW    Length >= 8MEDIUM Length >= 8, numeric, mixed case, and special charactersReload privilege tables now? (Press y|Y for Yes, any other key for No) : y Success.All done!

6、創建並配置數據庫:創建一個名爲 zabbix 的數據,併爲這個數據庫創建一個名爲 zabbix 的用戶,並設 置密碼爲 “Shanghai2010@”,然後爲這個用戶賦予 ​​​​​​​

[root@zabbix tmp]# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10Server version: 8.0.17 Source distributionCopyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.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> create database zabbix character set UTF8 collate utf8_bin;Query OK, 1 row affected, 2 warnings (0.19 sec)
mysql> create user 'zabbix'@'localhost' identified by 'Shanghai2010@';Query OK, 0 rows affected (0.08 sec)
mysql> grant ALL on zabbix.* to 'zabbix'@'localhost';Query OK, 0 rows affected (0.17 sec) mysql> flush privileges;Query OK, 0 rows affected (0.02 sec)
mysql> exitBye

7、安裝 Zabbix yum 庫:​​​​​​​

[root@zabbix ~]# wget https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm[root@zabbix ~]# dnf install -y zabbix-release-4.4-1.el8.noarch.rpm [root@zabbix ~]# dnf makecache

8、安裝 Zabbix 服務器組件

  [root@zabbix ~]# dnf install -y zabbix-server-mysql zabbix-web-mysql zabbix- apache-conf

9、使用Zabbix服務器安裝文件中提供的腳本創建Zabbix存儲庫。

[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -D zabbix -pShanghai2010@

 10、配置 Zabbix 服務器​​​​​​​

[root@zabbix ~]# vim /etc/zabbix/zabbix_server.confDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=Shanghai2010@

11、安裝 Zabbix Agent,並啓動服務​​​​​​​

 [root@zabbix ~]# dnf install -y zabbix-agent [root@zabbix ~]# systemctl enable --now zabbix-server  [root@zabbix ~]# systemctl enable --now zabbix-agent

三、配置 Zabbix 完成安裝

1、在瀏覽器中輸入 “http://服務IP” 

2、點擊 ”Next Step“

 

3、輸入 zabbix 數據庫的密碼,然後點擊 ”Next Step“

4、完成

5、Zabbix 默認的用戶名是 ”Admin“,密碼是 ”zabbix“。注意其中用戶名中的 ”A“ 是大 寫。

6、進入 Zabbix 的 Dashboard 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章