当前位置 主页 > 服务器问题 > Linux/apache问题 >

    zabbix 4.04 安装文档教程详解(基于CentOS 7.6)

    栏目:Linux/apache问题 时间:2020-01-04 00:46

    1    安装前准备:

    1.1   安装JDK

    卸载openjdk

    # rpm -qa | grep java
    # yum remove java-1.8.0-openjdk
    # yum remove java-1.8.0-openjdk-headless

    安装JDK包

    # rpm -ivh jdk-8u191-linux-x64.rpm

    1.2   安装依赖包

    # yum install -y net-snmp net-snmp-devel OpenIPMI-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

    以下3个包在DVD1中没有包含,如果配置的是本地yum源,需要单独安装

    # yum install -y libevent-devel-2.0.21-4.el7.x86_64.rpm
    # yum install -y libssh2-devel-1.4.3-12.el7.x86_64.rpm
    # yum install -y OpenIPMI-devel-2.0.23-2.el7.x86_64.rpm

    安装完依赖包以后可以使用以下命令检查是否都安装成功

    # rpm -qa net-snmp net-snmp-devel OpenIPMI-devel libssh2-devel openldap-devel openldap-clients libxml2-devel libcurl-devel gcc msyql-devel libevent-devel php-mysql php-gd php-mbstring php-bcmath libjpeg-devel freetype-devel libpng-devel php-xml keyutils-libs-devel krb5-devel libcom_err-devel libkadm5 libselinux-devel libsepol-devel openssl-devel pcre-devel zlib-devel

    1.3   安装MySQL

    详见MySQL安装文档

    1.4   安装nginx

    # tar -zxvf nginx-1.14.0.tar.gz -C /home
    # cd /home/nginx-1.14.0/
    # ./configure 
    # make & make install

    1.5   安装PHP

    # yum install -y php
    # yum install -y php-fpm-5.4.16-46.el7.x86_64.rpm

    2    安装服务:

    2.1   编译安装zabbix

    # groupadd --system zabbix
    # useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin zabbix
    # tar -zxvf zabbix-4.0.4.tar.gz -C /home
    # cd /home/zabbix-4.0.4/
    # ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --with-ldap --with-ssh2 --with-openipmi --enable-java --with-openssl
    # make install

    2.2   创建数据库

    # mysql -uroot -p<password>
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> grant all privileges on zabbix.* to zabbix@"serverip" identified by '<password>';
    mysql> quit
    # cd /home/zabbix-4.0.4/database/mysql
    # mysql -uzabbix -p<password> zabbix < schema.sql
    # mysql -uzabbix -p<password> zabbix < images.sql
    # mysql -uzabbix -p<password> zabbix < data.sql

    2.3   修改配置

    # vim /usr/local/zabbix/etc/zabbix_server.conf
    DBPassword=<password>

    2.4   启动服务

    # /usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf 
    # /usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf 
    # /usr/local/zabbix/sbin/zabbix_java/startup.sh