登录客户端服务器后,下载zabbix-4.2.3.tar.gz至/data,并安装相关依赖以及解压

    • zabbix官网
      • https://www.zabbix.com/download_sources
        1. cd /data
        2. yum install expect net-snmp gcc mysql-devel libxml2-devel net-snmp-devel libevent-devel curl-devel -y
        3. wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/4.2.3/zabbix-4.2.3.tar.gz/download && mv download zabbix-4.2.3.tar.gz
        4. tar -xvf zabbix-4.2.3.tar.gz && cd zabbix-4.2.3
        编译配置
        ./configure --prefix=/data/zabbix-agent \
        --with-openssl \
        --with-libcurl \
        --with-libxml2 \
        --with-libpcre \
        --with-iconv \
        --enable-agent
        
        使用最大CPU核数编译后安装
        make -j `nproc ` && make install
        
        修改配置文件中zabbix-server的 IP地址,以及本机主机名。
        sed -i 's/Server=127.0.0.1/Server=192.168.2.177/g' /data/zabbix-agent/etc/zabbix_agentd.conf
        sed -i 's/ServerActive=127.0.0.1/ServerActive=192.168.2.177/g' /data/zabbix-agent/etc/zabbix_agentd.conf
        sed -i 's/Hostname=Zabbix server/Hostname=dev/g' /data/zabbix-agent/etc/zabbix_agentd.conf
        echo ' Include=/data/zabbix-agent/etc/zabbix_agentd.conf.d/*.conf' >> /data/zabbix-agent/etc/zabbix_agentd.conf
        
        配置zabbix_agent自启动(有兴趣稍微研究一下自启动文件,以及为什么做软连接)
        ln -s /data/zabbix-agent/sbin/zabbix_agentd /usr/local/sbin/zabbix_agentd
        cp /data/zabbix-4.2.3/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd
        mv /data/zabbix-4.2.3 /data/installation/
        chmod 766 /etc/init.d/zabbix_agentd
        systemctl daemon-reload
        systemctl enable zabbix_agentd
        service zabbix_agentd restart
        chmod +s /bin/netstat