zabbix5.0安装配置

zabbix5.0安装配置

1.环境

IP系统配置
192.168.19.11Centos7.9zabbix_server
192.168.19.12Centos7.9zabbix_agent
192.168.19.13Centos7.9zabbix_agent

2.查看系统版本信息

[root@localhost ~]# yum -y install redhat-lsb-core
//查看系统信息
[root@localhost ~]# lsb_release -a 
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.9.2009 (Core)
Release:	7.9.2009
Codename:	Core

3.开始前的准备

//关闭防火墙
[root@localhost ~]# systemctl stop firewalld 
//设置开机不自启
[root@localhost ~]# systemctl disable firewalld 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
//查看防火墙的状态
[root@localhost ~]# systemctl status firewalld 
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
//临时关闭selinux
[root@localhost ~]# setenforce 0 
//永久关闭selinux
[root@localhost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

安装mariadb数据库

//安装mariadb数据库
[root@localhost ~]# yum install mariadb-server mariadb -y
//启动
[root@localhost ~]# systemctl start mariadb
//设置开机自启

数据库配置

//初始化数据库
[root@localhost ~]# mysql_secure_installation

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

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

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

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

Remove test database and access to it? [Y/n] 输入n
 ... skipping.

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

Cleaning up...
Thanks for using MariaDB!

//登录数据库
[root@localhost ~]# mysql -uroot -p
//设置数据库字符集
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
//创建zabbix用户并配置密码
MariaDB [(none)]> create user zabbix@localhost identified by 'Zabbix@666';
//给予zabbix用户权限
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;

安装阿里云的zabbix源

rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm

安装zabbix主服务和agent程序

yum install zabbix-server-mysql zabbix-agent -y

安装zabbix frontend(前端)

安装 Software Collections,便于后续安装高版本的 php,默认 yum 安装的 php 版本为 5.4 过低

[root@localhost ~]# yum install centos-release-scl -y

编辑/etc/yum.repos.d/zabbix.repo,启用zabbix前端源,将[zabbix-frontend]下的 enabled 改为 1

[root@localhost ~]# vim /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
[root@localhost ~]# yum -y install zabbix-web-mysql-scl zabbix-apache-conf-scl

导入初始架构和数据

[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
//进入数据库查看zabbix库有很多表就代表导入成功
[root@localhost ~]# mysql -uroot -p
MariaDB [(none)]> show databases;
MariaDB [(none)]> use zabbix;
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
| application_discovery      |
| application_prototype      |
| application_template       |
| applications               |
| auditlog                   |
| auditlog_details           |
| autoreg_host               |
| conditions                 |
| config                     |
| config_autoreg_tls         |
... ...
MariaDB [zabbix]> exit

修改zabbix server的主配置文件

//先备份一下配置文件
[root@localhost zabbix]# cp /etc/zabbix/zabbix_server.conf{,.bak}
将配置文件里的【# DBPassword=】改为【DBPassword=你的密码】,保存退出
注:你的密码那里要和之前创建的数据库用户zabbix的密码保持一致

修改zabbix前端页面的php时区

//先备份一下配置文件
[root@localhost ~]# cp /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf{,.bak}
将配置文件中的【; php_value[date.timezone] = Europe/Riga】改为【php_value[date.timezone] = Asia/Shanghai】

修改php配置文件

vim /etc/opt/rh/rh-php72/php.ini
将【max_execution_time = 30】改为【max_execution_time = 300】

将【date.timezone】改为【date.timezone = Asia/Shanghai】

启动zabbix server 及相关服务,并设置为开机自启

[root@localhost ~]# systemctl start zabbix-server zabbix-agent httpd rh-php72-php-fpm
[root@localhost ~]# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

验证服务是否启动成功

[root@localhost ~]# netstat -ntlup |grep zabbix
tcp        0      0 0.0.0.0:10050           0.0.0.0:*               LISTEN      8938/zabbix_agentd  
tcp        0      0 0.0.0.0:10051           0.0.0.0:*               LISTEN      8940/zabbix_server  
tcp6       0      0 :::10050                :::*                    LISTEN      8938/zabbix_agentd  
tcp6       0      0 :::10051                :::*                    LISTEN      8940/zabbix_server  

浏览器输入 http://192.168.19.11/zabbix 访问

在这里插入图片描述

所有组件都要是ok,下一步

在这里插入图片描述

输入数据库的端口号和密码,密码就是数据库用户zabbix的密码

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

用户名默认为 Admin,密码默认为 zabbix

在这里插入图片描述在这里插入图片描述

设置zabbix语言为中文

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述后续以后再补充

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值