当前位置: 移动技术网 > IT编程>开发语言>.net > CentOS 8.2 部署 Zabbix 5.0.2

CentOS 8.2 部署 Zabbix 5.0.2

2020年07月19日  | 移动技术网IT编程  | 我要评论

一、Zabbix简介

            Zabbix是一个免费的开源监控解决方案

二、环境介绍

            Zabbix Server:

                IP: 192.168.50.10

                OS: CentOS Linux release 8.2.2004 (Core)

            Zabbix Client:

                IP: 192.168.50.20

                OS: CentOS Linux release 8.2.2004 (Core)

            全部关闭了firewalld和selinux

三、部署Zabbix 5.0.2(以下操作在Server上进行)

            1、添加yum源

[root@zabbix ~]# dnf install -y epel-release
[root@zabbix ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm
[root@zabbix ~]# dnf clean all

            2、安装Zabbix server,Web前端,agent,数据库

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

            3、初始化数据库(‘1’为数据库root用户密码,可自定义)

[root@zabbix ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password: 1
Re-enter new password: 1
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

            4、创建数据库(数据库名为‘zabbix‘,数据库用户为’zabbix‘,zabbix用户密码为‘1’,皆可自定义)

[root@zabbix ~]# mysql -uroot -p
Enter password: 1
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by '1';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;

            5、导入初始架构和数据,系统将提示您输入新创建的密码。

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

            6、为Zabbix server配置数据库

[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf
DBPassword=1

            7、为Zabbix前端配置时区

[root@zabbix ~]# vim /etc/php-fpm.d/zabbix.conf
php_value[date.timezone] = Asia/Shanghai

            8、启动Zabbix server和agent进程

[root@zabbix ~]# systemctl restart zabbix-server zabbix-agent httpd php-fpm

            9、配置Zabbix前端

                  在浏览器中打开 http://192.168.50.10/zabbix

                  开始配置,下一步

                  检查之前所有配置是否正确,都没问题,下一步;如果有问题需要按实际情况排错

                  填入刚刚设置的数据库密码‘1’,如果前面设置数据库自定义了,按实际情况填入;如果和我一样,默认就好

                  取个名字,可自定义 ,其他默认

                  确认刚刚填入的信息,下一步

                   完成

                   使用默认用户名密码登录(Admin/zabbix) ,到此Zabbix 5.0.2部署完毕

四、添加一个需要被监控的服务器

            1、在被监控服务器上安装zabbix agent(以下操作在Client上进行)

[root@client ~]# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-agent-5.0.2-1.el8.x86_64.rpm

            2、配置zabbix-agent

[root@client ~]# vim /etc/zabbix/zabbix_agentd.conf
Server=192.168.50.10

            3、启动zabbix-agent

[root@client ~]# systemctl start zabbix-agent.service

            4、在页面上添加被监控服务器 

                  过一会儿,如无意外,就会是绿色,表示添加成功

            5、查看监控数据

 

五、最后一些闲话

            1、本文部署步骤参考了官方文档,地址:https://www.zabbix.com/download

            2、官方yum源服务器在美国,存在连接慢或下载失败的情况,可修改yum源为阿里云

                  在步骤“三、1”后操作

[root@zabbix ~]# vim /etc/yum.repos.d/zabbix.repo
baseurl=http://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/8/$basearch/

                  将步骤“四、1”操作修改为

rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/8/x86_64/zabbix-agent-5.0.2-1.el8.x86_64.rpm

 

本文地址:https://blog.csdn.net/weixin_43014903/article/details/107427237

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网