• CentOS 7 安装 Zabbix Server 5.0


    Pre-setup:已经安装好 mysql

    1. 关闭防火墙及 selinux

    # systemctl disable firewalld
    # systemctl stop firewalld
    # firewall-cmd --state
    not running
    # reboot
    # vi /etc/selinux/config

    2. 安装 Zabbix Server

    参考链接: 

    https://www.zabbix.com/download?zabbix=5.0&os_distribution=centos&os_version=7&db=mysql&ws=apache

     

    1)ADDING ZABBIX REPOSITORY

    # rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
    # yum clean all

     如果1)安装有问题,连接国外的服务器 repo.zabbix.com 经常连接失败,可参照 https://www.cnblogs.com/bruce-he/p/14385216.html

    2)SERVER/PROXY INSTALLATION

    # yum install zabbix-server-mysql zabbix-agent

     3)SERVER FRONTED

    # yum install centos-release-scl

    Edit file /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.

    [zabbix-frontend]
    ...
    enabled=1
    ...

    Install Zabbix frontend packages.

    # yum install zabbix-web-mysql-scl zabbix-apache-conf-scl

    4)Run the following on your database host.

    # mysql -uroot -p
    <password1>
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> create user zabbix@localhost identified by '<password2>';
    mysql> grant all privileges on zabbix.* to zabbix@localhost;
    mysql> flush privileges; mysql
    > quit;

    备注: password1为 mysql root用户的密码; password2为设置的 zabbix 用户的密码

    5)On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password

    # zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

    解决 mysql command not found

    # ln -s /mnt/software/mysql/bin/mysql /usr/bin
    # ln -s /mnt/data/mysql3307/mysql.sock /tmp/mysql.sock
    
    备注:将 mysql 的bin 目录和 data的 sock 软连接到系统默认

    6)CONFIGURE DATABASE FOR ZABBIX SERVER/PROXY

    # vi /etc/zabbix/zabbix_server.conf
    DBHost=localhost
    DBName=zabbix
    DBUser=zabbix
    DBPassword=<password>

    7)Configure PHP for Zabbix frontend

    # vi /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
    
    php_value[date.timezone] = Asia/Shanghai

    8)STARTING ZABBIX SERVER PROCESS

    # systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
    # systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm

    3. 配置 front

          登录 http://zabbixserverip/zabbix,用户名密码为 Admin/zabbix

        

    4. 安装 Zabbix agent 并启动

    安装zabbix agent
    # yum install zabbix-agent
    
    启动 zabbix agent
    # systemctl restart zabbix-agent
    # systemctl enable zabbix-agent

    问题

    1. Zabbix server is running, value = No

     # tailf  /var/log/zabbix/zabbix_server.log
      connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

      解决办法:

    # vi /etc/zabbix/zabbix_server.conf
    
       DBSocket=/tmp/mysql.sock
    
       备注: 配置 DBSocket
    
    # systemctl stop zabbix-server
    # systemctl start zabbix-server

    2. Zabbix front php 配置有问题,需要重新配置时, http://ip/zabbix/setup.php

    3. 安装zabbix之后登陆报错:Error connecting to database: No such file or directory

      修改php.ini文件

    [root@office_zabbix4_007117 etc]#vim /usr/local/php/etc/php.ini

    mysqli.default_socket = /mnt/data/mysql3307/mysql.sock

        添加上面一行,指向mysql 真正运行的 socket

  • 相关阅读:
    測试能否发表博客
    换站点Logo图片---轻开电子商务系统(企业入门级B2C站点)
    后台运行命令:&amp;和nohup command &amp; 以及关闭、查看后台任务
    HttpClient将手机上的数据发送到服务器
    支付宝电脑网站支付
    远程使用tomcat8的首页的管理工具
    数据结构之链表基本操作
    数据结构之链表反向打印
    ultraedit开发使用技巧
    charles抓取https中出现unknow
  • 原文地址:https://www.cnblogs.com/bruce-he/p/14381921.html
Copyright © 2020-2023  润新知