zabbix-5.0-保姆级(无坑)搭建教程

环境准备:

一台192.168.88.136Centos虚拟机 

关闭防火墙:systemctl stop firewalld

永久关闭防火墙:systemctl disable firewalld

关闭selinux: setenforce 0 

备份yum库:mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOSBase.repo.backup

配置yum源:wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

配置epel:  wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

一、修改主机名:

hostnamectl set-hostname zabbix_server

-su

二、使用阿里提供的zabbixYUM源

vim /etc/yum.repos.d/zabbix.repo

[zabbix]
name=alibaba zabbix
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
gpgcheck=0
enabled=1
      
[zabbix2]
name=alibaba zabbix frontend    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
gpgcheck=0
enabled=1    
 

[zabbix]
name=alibaba zabbix
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
gpgcheck=0
enabled=1
      
[zabbix2]
name=alibaba zabbix frontend    baseurl=https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
gpgcheck=0
enabled=1      

三、安装Zabbix服务器

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

注释:

zabbix-server-mysql:数据库

zabbi-agent:代理程序(上报信息的程序)

2、yum install centos-release-scl

注释:centos发布scl

SCL 是一种包管理机制,允许你在 Red Hat 系列 Linux 系统上同时使用系统默认的软件版本和额外安装的多个版本。例如,你可以同时使用系统自带的 PHP 5.4 和通过 SCL 安装的 PHP 7.4。

3、重命名原来的文件

3.1、cd /etc/yum.repos.d/    (切换目录)
3.2、mv CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.bak
3.3、mv CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.bak

编辑CentOS-SCLo-scl-rh.repo文件:

3.4、vim CentOS-SCLo-scl-rh.repo

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

4、yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

注释:zabbix前台页面

四、安装数据库

监控的时候,会产生很多的数据,数据需要保存在数据库中,所以我们此处开始创建数据库

1、安装数据库

1.1、yum -y install mariadb mariadb-server

2、启动数据库

2.1、systemctl enable mariadb    (永久生效)

2.2、systemctl start mariadb          (开启mariadb服务)

3、授权zabbix账号

mysql

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> create user zabbix@localhost identified by 'ChenFuguo@123';

mysql> grant all privileges on zabbix.* to zabbix@localhost;

mysql> flush privileges;

mysql> quit;

4、初始化zabbix

4.1、ls /usr/share/doc/zabbix-server-mysql-5.0.43/

注释:AUTHORS  ChangeLog  COPYING  create.sql.gz  double.sql  NEWS  README
create.sql.gz  是zabbix官方给我们生成的是zabbix数据库建表文件

4.2、zcat /usr/share/doc/zabbix-server-mysql-5.0.43/create.sql.gz | mysql -uzabbix -p'ChenFuguo@123' zabbix

注释:把create.sql.gz这个sql文件,导入到zabbix数据库

五、启动zabbix服务

5.1、配置sql账号密码

vim /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=ChenFuguo@123

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=ChenFuguo@123

5.2、启动zabbix

systemctl enable zabbix-server.service

systemctl start zabbix-server.service

5.3、编辑Zabbix前端的PHP配置

vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

php_value date.timezone Asia/Shanghai

systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm  (启动服务)

systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm   (永久生效)

六、搭建完毕

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值