CentOS8 搭建zabbix监控系统

哈喽,有些时间没有更新公众号。今日更新一下。

安装MySQL数据库

# 安装wget
[root@cby ~]# dnf install wget -y
# 下载MySQL源
[root@cby ~]# wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
[root@cby ~]# dnf localinstall mysql80-community-release-el8-1.noarch.rpm -y
# 启用8.0的源
[root@cby ~]# dnf config-manager --enable mysql80-community
[root@cby ~]# dnf install mysql-community-serve
[root@cby ~]# systemctl start mysql
#查看初始密码
[root@cby ~]# sudo grep 'temporary password' /var/log/mysqld.log

登陆数据库并修改密码

[root@cby ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.19


Copyright (c) 2000, 2020, 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;^C
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Cby123..';
Query OK, 0 rows affected (0.00 sec)


创建用户并授权

mysql> CREATE USER cby IDENTIFIED BY 'Cby123..';
Query OK, 0 rows affected (0.00 sec)


mysql> grant all privileges on zabbix.* to 'cby'@'%';
Query OK, 0 rows affected (0.00 sec)


1、安装 Zabbix源信息

[root@cby ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
Retrieving https://repo.zabbix.com/zabbix/4.4/rhel/8/x86_64/zabbix-release-4.4-1.el8.noarch.rpm
warning: /var/tmp/rpm-tmp.kiCvdT: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-release-4.4-1.el8         ################################# [100%]

2、安装Zabbix server and agent

[root@cby ~]# dnf install zabbix-server-mysql zabbix-agent

3、创建初始数据库

mysql> use zabbix;
Database changed
mysql> source /root/create.sql


4、编辑配置文件 /etc/zabbix/zabbix_server.conf

vim /etc/zabbix/zabbix_server.conf


DBHost=localhost          # 数据主机名
DBName=zabbix            # 数据库实例
DBUser=zabbix              # 用户名
DBPassword=zabbix      # 密码

5、编辑配置文件 /etc/httpd/conf.d/zabbix.conf

6、编辑配置文件 /etc/php-fpm.d/zabbix.conf

php_value[date.timezone] = Europe/Riga

7、启动Zabbix server和agent进程,并为它们设置开机自启:

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

8、关闭防火墙

[root@cby ~]#  firewall-cmd --state    #查看默认防火墙状态
not running
[root@cby ~]#  systemctl stop firewalld.service      #临时关闭firewall
[root@cby ~]#  systemctl disable firewalld.service       #禁止firewall开机启动

9、编辑Apache的配置文件

[root@cby ~]#  vi /etc/httpd/conf.d/zabbix.conf


php_value max_execution_time 300


php_value memory_limit 128M


php_value post_max_size 16M


php_value upload_max_filesize 2M


php_value max_input_time 300


php_value always_populate_raw_post_data -1


php_value date.timezone Asia/Shanghai

10、设置阿帕奇开机自启

[root@cby ~]# systemctl start httpd     #启动httpd服务
[root@cby ~]# systemctl enable httpd    #设置开机启动httpd服务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值