企业实战|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.
# 中间全部y
VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No: y
There are three levels of password validation policy:
LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
Reload 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 -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10
Server version: 8.0.17 Source distribution
Copyright (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> exit
Bye

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.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=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 **
在这里插入图片描述

参考链接:

企业实战|CentOS8安装Zabbix 4.4 : https://mp.weixin.qq.com/s/AR-Xnf3_YHA_CJrF_8FLvg

发布了364 篇原创文章 · 获赞 66 · 访问量 14万+

猜你喜欢

转载自blog.csdn.net/qq_40907977/article/details/105497937
4.4