centos7使用repo方式安裝zabbix4.0

1.安裝zabbix的repo源

rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm

在這裏插入圖片描述

修改zabbix.repo替換爲清華的地址

:%s#repo.zabbix.com#mirrors.tuna.tsinghua.edu.cn/zabbix#g

2.安裝zabbix-server-mysql和zabbix-web-mysql

yum install zabbix-server-mysql zabbix-web-mysql -y

在這裏插入圖片描述

3.安裝配置數據庫mariadb-server,導入數據庫

yum install mariadb-server -y

在這裏插入圖片描述

systemctl enable mariadb.service
systemctl start mariadb.service
# 初始化
mysql_secure_installation
mysql -uroot -p
CREATE DATABASE zabbix character set utf8 collate utf8_bin;
GRANT all ON zabbix.* TO 'zabbix'@'%' IDENTIFIED BY 'root123';
flush privileges;
quit
# 查詢sql路徑
rpm -ql zabbix-server-mysql
cd /usr/share/doc/zabbix-server-mysql-4.0.19/
# 解壓sql文件
gzip -d create.sql.gz
# 執行導入
mysql -uzabbix -proot123 zabbix < create.sql

4.修改zabbix-server的配置文件

vim /etc/zabbix/zabbix_server.conf
# 修改一下項
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=root123
systemctl enable zabbix-server.service
systemctl start zabbix-server.service
netstat -nltp
# 查看啓動日誌
vim /var/log/zabbix/zabbix_server.log

5.修改zabbix-web配置文件

# 修改時區
vim /etc/httpd/conf.d/zabbix.conf
# php_value date.timezone Asia/Shanghai
# 啓動apache
systemctl enable httpd
systemctl start httpd

配置web

http://ip地址/zabbix

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

  • 登錄

默認用戶名:Admin 密碼:zabbix

在這裏插入圖片描述

在這裏插入圖片描述

2.添加監控主機

  • 在zabbix-server機器上添加
yum install zabbix-agent -y
systemctl enable zabbix-agent.service
systemctl start zabbix-agent.service
  • 在非zabbix-server機器上添加
wget https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.9-3.el7.x86_64.rpm
rpm -ivh zabbix-agent-4.0.9-3.el7.x86_64.rpm
# 修改配置
vim /etc/zabbix/zabbix_agentd.conf

# Server=服務端IP

# 啓動
systemctl enable zabbix-agent.service
systemctl start zabbix-agent.service

3.web端添加主機

在這裏插入圖片描述

  • 檢查是否成功收集主機的信息

在這裏插入圖片描述

PS:

1.阿里雲開放端口:以80端口爲例

在這裏插入圖片描述

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