• centos7上zabbix6.06安装记录


    一、安装php7

    1、安装EPEL和Remi存储库

    yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    
    • 1
    • 2

    2、安装yum-utils

    yum install yum-utils -y
    
    • 1

    3、移除老版本php

      4、选择php版本,并安装

      # 安装底层依赖
       yum -y install gcc-c++ mysql-devel net-snmp-devel libevent-devel harfbuzz libxml2 libxml2-devel mtr bc  telnet yum-utils curl-devel
      # 选择php版本
      yum-config-manager --enable remi-php74
      # 安装php及扩展
      yum -y install php php-cli php-common php-gd php-json php-ldap php-mbstring php-mysqlnd php-pdo php-xml \
      php-devel php-embedded php-mcrytp php-pecl-mongodb php-pecl-redis php-pecl-memcached php-opcache php-fpm
      # 查看php版本及扩展信息
      php -v
      php -m 
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10

      二、安装mysql8数据库

      1、配置mysql源

      #下载MySQL源
      wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
      #配置MySQL源
      yum -y install mysql80-community-release-el7-5.noarch.rpm
      # 安装MySQL相关依赖
      yum -y install gcc-c++ mysql-devel net-snmp-devel libevent-devel
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6

      2、安装mysql

      # 安装mysql
      yum install -y mysql-community-libs-compat-8.0.30-1.el7.x86_64 \
       mysql-community-common-8.0.30-1.el7.x86_64 \
       mysql-community-libs-8.0.30-1.el7.x86_64 \
       mysql-community-client-8.0.30-1.el7.x86_64 \
       mysql-community-server-8.0.30-1.el7.x86_64 \
       mysql-community-devel-8.0.30-1.el7.x86_64 \
       mysql-community-client-plugins-8.0.30-1.el7.x86_64 \
       mysql-community-icu-data-files-8.0.30-1.el7.x86_64
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9

      3、优化配置文件

      # 文件路径: /etc/my.cnf
      # For advice on how to change settings please see
      # http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html
      
      [mysqld]
      datadir=/data/mysql
      socket=/var/lib/mysql/mysql.sock
      pid-file=/var/run/mysqld/mysqld.pid
      # Disabling symbolic-links is recommended to prevent assorted security risks
      symbolic-links=0
      innodb_file_per_table=1
      log-error=/var/log/mysqld.log
      max_connections=2000
      max_allowed_packet=16M
      max_connect_errors=400
      
      tmp_table_size = 32M
      innodb_buffer_pool_size=8G
      
      !includedir /etc/my.cnf.d
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20

      4、启动mysql

      systemctl start mysqld
      systemctl enable mysqld
      
      • 1
      • 2

      5、修改初始密码

      # 查看初始密码
      cat /var/log/mysqld.log |grep 'A temporary password is generate'
      # 设置密码
      mysql -uroot -p
      ALTER USER 'root'@'localhost' IDENTIFIED BY 'your password';
      
      # 由于MySQL8.0 有密码验证组件,若希望设置简单的密码,需要修改服务验证条件
      # 密码检查等级,0/LOW、1/MEDIUM、2/STRONG
      set global validate_password.policy=0;
      # 密码的最短长度
      set global validate_password.length=6;
      # 密码至少要包含的小写字母个数和大写字母个数
      set global validate_password.mixed_case_count=0;
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13

      三、安装zabbix

      1、下载安装包

      wget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.6.tar.gz
      
      • 1

      2、安装zabbix

      # 创建zabbix组
      groupadd zabbix
      # 创建zabbix用户
      useradd  -g zabbix -M -s /sbin/nologin zabbix
      
      # 创建zabbix目录
      mkdir /usr/local/zabbix
      # 解压
      tar -zxvf zabbix-6.0.6.tar.gz -C /usr/local/zabbix/
      # 移动到zabbix目录
      cd /usr/local/zabbix/zabbix-6.0.6/
      # 编译
      ./configure --prefix=/usr/local/zabbix \
       --enable-server \
       --enable-agent \
       --enable-proxy \
       --with-mysql \
       --enable-ipv6 \
       --with-net-snmp \
       --with-libcurl \
       --with-libxml2
       # 编译二
      make install
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20
      • 21
      • 22
      • 23

      四、启动zabbix-proxy服务器

      1、创建代理数据库

      # 创建zabbix库
      create database zabbix_proxy  character set utf8mb4 collate utf8mb4_bin;  
      # 创建zabbix用户
      create user zabbix@localhost identified by 'Zabbix@123'; 
      # 授权
      grant all privileges on zabbix_proxy  .* to zabbix@localhost;
      # 导入初始表
      mysql -uzabbix -pZabbix@123 zabbix_proxy </usr/local/zabbix/zabbix-6.0.6/database/mysql/schema.sql
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8

      2、修改zabbix-proxy配置文件

      Server=212.129.239.109:10051
      Hostname=x2-global-hk-proxy
      LogFile=/var/log/zabbix/zabbix_proxy.log
      LogFileSize=0
      PidFile=/usr/local/zabbix/zabbix_proxy.pid
      SocketDir=/usr/local/zabbix
      DBHost=localhost
      DBName=zabbix_proxy
      DBUser=zabbix
      DBPassword=Zabbix@123
      ConfigFrequency=600
      DataSenderFrequency=3
      StartPollers=100
      StartDBSyncers=5
      Timeout=5
      ExternalScripts=/usr/local/zabbix/share/zabbix/externalscripts
      LogSlowQueries=3000
      
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17

      3、启动zabbix-proxy

      #权限
      chown -R zabbix. /var/log/zabbix/
      chown -R zabbix. /usr/local/zabbix/
      # 启动
      /usr/local/zabbix/sbin/zabbix_proxy
      
      • 1
      • 2
      • 3
      • 4
      • 5
    • 相关阅读:
      jsDate总的毫秒数(时间戳)
      腾讯位置服务
      ABP - 依赖注入(1)
      Python中文分词及词频统计
      【建站教程】使用阿里云服务器怎么搭建网站?
      Linux常用命令
      arthars在线诊断
      靠这套pytest接口自动化测试框架,击败99%的人
      怎么强制粘贴密码进去
      SpringBoot常见注解
    • 原文地址:https://blog.csdn.net/wwzhang0307/article/details/126140056