zoukankan      html  css  js  c++  java
  • Zabbix系列-REHL6.10离线方式安装Zabbix 4.0 LTS

    环境

    第零步:关闭系统默认防火墙

    setenforce 0
    sed -i -r "/^SELINUX=/c SELINUX=disabled" /etc/selinux/config
    which systemctl && systemctl stop firewalld
    which systemctl && systemctl disable firewalld
    which systemctl && systemctl stop iptables || service iptables stop
    which systemctl && systemctl disable iptables || chkconfig iptables off
    

    第一步:安装MySQL

    1.上传下载好的rpm文件到服务器并安装
    yum install -y mysql-community-client-5.7.24-1.el6.x86_64.rpm 
                    mysql-community-common-5.7.24-1.el6.x86_64.rpm 
                    mysql-community-libs-5.7.24-1.el6.x86_64.rpm 
                    mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm 
                    mysql-community-server-5.7.24-1.el6.x86_64.rpm
    
    2.启动MySQL数据库
    service mysqld start
    chkconfig mysqld on
    service mysqld status
    chkconfig --list mysqld
    
    3.修改root密码并登录数据库
    sudo grep 'temporary password' /var/log/mysqld.log
    mysql -uroot -p
    mysql> ALTER USER root@localhost IDENTIFIED BY 'Xiaoliu123!';
    mysql> exit;
    

    第二步:安装httpd

    1.配置本地yum并安装开发工具
    mkdir /mnt/cdrom
    mount /dev/cdrom /mnt/cdrom
    
    cat <<EOF >/etc/yum.repos.d/local.repo
    [local]
    name=local
    baseurl=file:///mnt/cdrom
    gpgcheck=0
    enabled=1
    EOF
    
    yum clean all       #清理本地缓存
    yum clean plugins   #清理插件缓存
    yum makecache       #构建缓存
    
    # 区分REHL6还是REHL7
    which systemctl && yum group install -y "Development Tools" || yum groupinstall -y "Development Tools"
    
    2.源码方式安装依赖项和Apache HTTP Server
    # 安装expat-devel(这里注意使用yum安装,rpm安装后报错没有找到原因)
    yum install expat-2.0.1-13.el6_8.x86_64.rpm expat-devel-2.0.1-13.el6_8.x86_64.rpm
    
    # 下载依赖包
    wget https://ftp.pcre.org/pub/pcre/pcre-8.42.tar.gz
    wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.gz
    wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.37.tar.gz
    wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
    
    # 安装pcre
    tar vxzf pcre-8.42.tar.gz
    cd pcre-8.42
    ./configure
    make
    make install
    
    # 这里为了保证每一步都正确安装使用echo $?命令查看命令执行结果是否有问题
    # 0代表每问题,非0都是有问题的
    tar -vxf apr-1.6.5.tar.gz
    cd apr-1.6.5
    ./configure --prefix=/usr/local/apr
    echo $?
    make
    echo $?
    make install
    echo $?
    
    
    tar -vxf apr-util-1.6.1.tar.gz
    cd apr-util-1.6.1
    ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
    echo $?
    make && make install && echo $?
    
    
    tar -vxf httpd-2.4.37.tar.gz
    cp -a apr-1.6.5 httpd-2.4.37/srclib/apr
    cp -a apr-util-1.6.1 httpd-2.4.37/srclib/apr-util/
    cd httpd-2.4.37
    ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
    echo $?
    make && make install && echo $?
    
    3.启动httpd
    默认安装路径:/usr/local/apache2/
    
    # 编辑配置文件增加以下行
    vim /usr/local/apache2/conf/httpd.conf
    ServerName 0.0.0.0:80
    
    # 启动httpd
    /usr/local/apache2/bin/apachectl -k start
        
        -k start        启动
        -k restart      重新启动
        -k graceful     优雅的重启(重读配置文件,如果配置文件有问题,将继续用原来配置文件运行)
        -k graceful-stop    优雅的停止
        -k stop         停止
    
    http://10.0.1.101/
    

    第三步:安装PHP支持(版本要求5.4.0 或以上)

    1.安装支持
    yum install -y cyrus-sasl-2.1.23-15.el6_6.2.x86_64.rpm 
                    cyrus-sasl-devel-2.1.23-15.el6_6.2.x86_64.rpm 
                    freetype-devel-2.3.11-17.el6.x86_64.rpm 
                    libjpeg-turbo-devel-1.2.1-3.el6_5.x86_64.rpm 
                    libpng-1.2.49-2.el6_7.x86_64.rpm 
                    libpng-devel-1.2.49-2.el6_7.x86_64.rpm 
                    libxml2-devel-2.7.6-21.el6_8.1.x86_64.rpm 
                    openldap-2.4.40-16.el6.x86_64.rpm 
                    openldap-devel-2.4.40-16.el6.x86_64.rpm 
                    zlib-devel-1.2.3-29.el6.x86_64.rpm
    
    2.下载并安装PHP5.6.40并安装
    wget http://101.96.10.63/cn2.php.net/distributions/php-5.6.40.tar.gz
    tar -vxf php-5.6.40.tar.gz
    cp -frp /usr/lib64/libldap* /usr/lib/
    cd php-5.6.40
    ./configure --enable-bcmath --enable-mbstring --enable-fpm --enable-mbstring 
        --with-apxs2=/usr/local/apache2/bin/apxs --enable-sockets --with-mysql --with-gettext 
        --with-ldap --with-png-dir --with-jpeg-dir --with-freetype-dir --with-gd
    
    make && make install && echo $?
    
    3.设置PHP
    # copy配置文件
    cp php-5.6.40/php.ini-production /usr/local/lib/php.ini
    
    # 编辑httpd.conf
    vim /usr/local/apache2/conf/httpd.conf
    添加:
    <FilesMatch .php$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    
    # 重启httpd服务
    /usr/local/apache2/bin/apachectl -k stop
    /usr/local/apache2/bin/apachectl -k start
    
    4.测试PHP
    vim /usr/local/apache2/htdocs/index.php
    <?php 
                phpinfo();
        ?>
        
    http://10.0.1.101/index.php
    

    第四步:安装Zabbix

    1.将下载好的rpm包上传服务器并安装
    yum install -y fping-2.4b2-16.el6.x86_64.rpm 
                    iksemel-1.4-2.el6.x86_64.rpm 
                    lm_sensors-libs-3.1.1-17.el6.x86_64.rpm 
                    net-snmp-libs-5.5-60.el6.x86_64.rpm 
                    OpenIPMI-libs-2.0.16-14.el6.x86_64.rpm 
                    unixODBC-2.2.14-14.el6.x86_64.rpm 
                    zabbix-agent-4.0.3-1.el6.x86_64.rpm 
                    zabbix-server-mysql-4.0.3-1.el6.x86_64.rpm
    
    2.创建初始数据库
    mysql -uroot -p
    mysql> create database zabbix character set utf8 collate utf8_bin;
    mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'Xiaoliu123!';
    mysql> quit;
    
    3.导入初始架构和数据,系统将提示您输入新创建的密码。
    zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
    
    4.为Zabbix server配置数据库
    vim /etc/zabbix/zabbix_server.conf
    DBPassword=Xiaoliu123!
    
    5.处理zabbix PHP databases support faild问题

    处理方法:安装Mysqli模块

    单独来编译mysqli,mysqli是优化过的mysql函数库,MYSQL版本不能低于4.1.12
    用phpize生成configure文件,然后编译安装
    
    cd php-5.6.40/ext/mysqli
    /usr/local/bin/phpize
    ./configure
    make
    make install
    
    6.为Zabbix前端配置PH
    vim /usr/local/lib/php.ini
    post_max_size = 8M          # 改为16MB
    max_execution_time = 30     # 改为300
    max_input_time = 60         # 改为300
    date.timezone = Asia/Shanghai
    always_populate_raw_post_data = -1
    extension=mysqli.so         # 增加本行
    
    # 重启httpd服务
    /usr/local/apache2/bin/apachectl -k stop
    /usr/local/apache2/bin/apachectl -k start
    
    7.将前端页面文件放到httpd目录
    wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz
    tar -vxf zabbix-4.0.3.tar.gz
    cp -a zabbix-4.0.3/frontends/php/* /usr/local/apache2/htdocs/
    
    8.配置Zabbix前端
    http://10.0.1.101/index.php
        1.欢迎页面:Next step
        2.环境检查:Next step
        3.数据库信息:填入密码,如果数据库是在本机安装的可以保持默认
        4.服务器详细信息:可以保持默认
        5.安装前总计:Next step
        6.Instll根据提示下载配置文件并放入指定路径
        7.完成,会自动跳转登录界面,默认登录账号密码:Adminzabbix
    
    9.启动Zabbix服务端和Agent
    service zabbix-server start
    service zabbix-agent start
    chkconfig zabbix-server on
    chkconfig zabbix-agent on
    
    service zabbix-server status
    service zabbix-agent status
    chkconfig --list zabbix-server
    chkconfig --list zabbix-agent
    

    附录:所有用到离线文件下载

    ApacheHTTPServer2.4.37_REHL67:https://pan.baidu.com/s/1VVdxn4SL30FhJ5dmhSeiwg

    Mysql5.6_REHL6:https://pan.baidu.com/s/1bSJ1NWFh1Cw9a-drwUG5kQ

    PHP5.6.40_REHL6:https://pan.baidu.com/s/1aGY3Jk5BFBf_EaG6KnVSwA

    Zabbix-4.0.3_REHL6:https://pan.baidu.com/s/18btZ4KDIW9CJzuDL0U5VPw

    附录:

    PHP官网:http://www.php.net/

    Apache官网:http://httpd.apache.org/download.cgi

    MySQL Yum存储库:https://dev.mysql.com/downloads/repo/yum/

    Zabbix官网:https://www.zabbix.com/




  • 相关阅读:
    JavaSE 学习笔记04丨异常
    Codeforces Round #677 (Div. 3) E、G题解
    JavaSE 学习笔记03丨继承、接口、多态、内部类
    ftp通过了用户验证但是连接超时
    实型变量
    3dmax放样
    画直线算法
    VAE变分自动编码器
    RNN 、LSTM长短期记忆网络
    java比较字符串
  • 原文地址:https://www.cnblogs.com/khstudy/p/10750702.html
Copyright © 2011-2022 走看看