• CentOS 7 安装 Zabbix Server 4.0


    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/documentation/4.0/manual/installation/install_from_packages/rhel_centos

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

     

    1)ADDING ZABBIX REPOSITORY

    # rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

    2)FRONTEND INSTALLATION PREREQUISITES

    # yum-config-manager --enable rhel-7-server-optional-rpms

    如果遇到 yum-config-manager command not found,安装 yum-utils 后,再执行 上一语句

    # yum -y install yum-utils

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

    3)SERVER/PROXY/FRONTEND INSTALLATION

    复制代码
    To install Zabbix server
    # yum install zabbix-server-mysql
    
    To install Zabbix proxy with MySQL support:
    # yum install zabbix-proxy-mysql
    
    To install Zabbix frontend (available for RHEL 7, deprecated on RHEL 6) with MySQL support:
    # yum install zabbix-web-mysql
    复制代码

    解决 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 软连接到系统默认

    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

    6)CONFIGURE DATABASE FOR ZABBIX SERVER/PROXY

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

    7)STARTING ZABBIX SERVER PROCESS

    # service zabbix-server start
    # systemctl enable zabbix-server

    8)ZABBIX FRONTEND CONFIGURATION

    复制代码
    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 max_input_vars 10000
    php_value always_populate_raw_post_data -1
    php_value date.timezone Asia/Shanghai
    复制代码

    9)SELINUX CONFIGURATION if Having SELinux status enabled in enforcing mode

    # setsebool -P httpd_can_connect_zabbix on
    If the database is accessible over network (including 'localhost' in case of PostgreSQL), you need to allow Zabbix frontend to connect to the database too:
    # setsebool -P httpd_can_network_connect_db on

    10)启动apache/zabbix-server服务并设置为开机启动

    # systemctl start httpd
    # systemctl enable httpd
    # netstat -an |grep 80
    tcp        0      0 192.168.56.11:80        0.0.0.0:*               LISTEN 
    # systemctl start zabbix-server
    # systemctl enable zabbix-server

    3. 配置 fronted

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

        

    4. 安装 Zabbix agent 并启动

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

    安装完待解决问题:图形显示不了,F12 提示 chart2.php 500 错误。 后改为安装 Zabbix Server 5 没有问题(https://www.cnblogs.com/bruce-he/p/14381921.html)

    问题

    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

  • 相关阅读:
    Ubuntu安装截图软件shutter
    Ubuntu18.04安装破解版MATLAB2018b
    Ubuntu18.04安装UHD+GNU Radio后找不到USRP B210解决办法
    USRP B210 更改A通道或B通道
    性能测试总结(三)--工具选型篇
    性能测试总结(二)---测试流程篇(转载)
    性能测试总结(一)---基础理论篇(转载)
    selenium 自动化测试面试题及答案
    Appium-测试失败后屏幕截图的
    七 Appium常用方法介绍
  • 原文地址:https://www.cnblogs.com/bruce-he/p/14396465.html
Copyright © 2020-2023  润新知