CentOS7 安装配置 Zabbix

环境

  1. centos 7
  2. mariadb 5.5
  3. zabbix 5.0

安装步骤

  1. 环境
# 配置yum
[root@localhost home]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost home]# yum clean all
[root@localhost home]# yum update
[root@localhost home]# yum makecache
# 关闭SELINUX和firewalld
[root@localhost home]# setenforce 0
[root@localhost home]# systemctl stop firewalld
[root@localhost home]# systemctl disable firewalld
  1. 安装zabbix库
[root@localhost home]# rpm -Uvh https://repo.zabbix.com/zabbix/4.5/rhel/7/x86_64/zabbix-release-4.5-2.el7.noarch.rpm
  1. 安装zabbinx web前端、server和agent
# 启用scl软件集
[root@localhost home]# yum install centos-release-scl
# 启用zabbix仓库
[root@localhost home]# vi /etc/yum.repos.d/zabbix.repo 
	[zabbix-deprecated]
	...
	enabled=1
	...
# 安装zabbix前端、server和agent
[root@localhost home]# yum install zabbix-web-mysql-scl zabbix-nginx-conf-scl
[root@localhost home]# yum install zabbix-server-mysql zabbix-agent
  1. 初始化mariadb
[root@localhost home]# yum install -y mariadb mariadb-server 
[root@localhost home]# mysql_secure_installation 
[root@localhost home]# systemctl start mariadb
[root@localhost home]# mysql -u root -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)

  1. 初始化zabbix库
# sql位置:/usr/share/doc/zabbix-server-mysql*/create.sql.gz 
[root@localhost home]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: 
[root@localhost home]# mysql -u zabbix -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 15
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| zabbix             |
+--------------------+
2 rows in set (0.07 sec)

MariaDB [(none)]> use zabbix
Database changed
MariaDB [zabbix]> show tables;
+----------------------------+
| Tables_in_zabbix           |
+----------------------------+
| acknowledges               |
| actions                    |
| alerts                     |
... ... ... ...
| users                      |
| users_groups               |
| usrgrp                     |
| valuemaps                  |
| widget                     |
| widget_field               |
+----------------------------+
154 rows in set (0.00 sec)

MariaDB [zabbix]> 

  1. 配置zabbix-server数据库、用户、密码
[root@localhost home]# vi /etc/zabbix/zabbix_server.conf

在这里插入图片描述

  1. 配置nginx、PHP相关文件
# 配置nignx监听端口及服务名
[root@localhost home]# vi /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf

(如果你不从这台服务器访问的话,server_name要配置服务器IP地址)
在这里插入图片描述

# 配置php用户及时区
[root@localhost home]# vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf

在这里插入图片描述

  1. 启动zabbix
[root@localhost home]# systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
	Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service.
	Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-agent.service to /usr/lib/systemd/system/zabbix-agent.service.
	Created symlink from /etc/systemd/system/multi-user.target.wants/rh-nginx116-nginx.service to /usr/lib/systemd/system/rh-nginx116-nginx.service.
	Created symlink from /etc/systemd/system/multi-user.target.wants/rh-php72-php-fpm.service to /usr/lib/systemd/system/rh-php72-php-fpm.service.
[root@localhost home]# systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
  1. web页面初始化
    http://192.168.0.104/
    默认用户名密码:Admin/zabbix
    在这里插入图片描述
    在这里插入图片描述
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xieet_0

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值