我安装的是4.2.1版本
先上传好安装包
然后解压
[root@localhost ~]#tar xf zabbix-4.2.1.tar.gz
安装依赖包
[root@localhost ~]# yum install pcre-devel openssl-devel zlib-devel gcc
创建一个服务运行用户
[root@localhost ~]#cd zabbix-4.2.1/
[root@localhost zabbix-4.2.1~]#useradd -s /sbin/nologin zabbix
预编译
[root@localhost zabbix-4.2.1~]#./configure --enable-agent --prefix=/opt/zabbix
编译安装
[root@localhost zabbix-4.2.1~]#make install
创建一个日志目录
[root@localhost zabbix-4.2.1~]#mkdir -p /opt/zabbix/logs
修改目录属主
[root@localhost ~]#chown zabbix /opt/zabbix/logs
修改配置文件
[root@localhost ~]#sed -i 's#^LogFile.*$#LogFile=/opt/zabbix/logs/zabbix_agentd.log#'
[root@localhost ~]#/opt/zabbix/etc/zabbix_agentd.conf
[root@localhost ~]#sed -i 's#^Server=.*$#Server=127.0.0.1,zabbix服务器IP#' /opt/zabbix/etc/zabbix_agentd.conf
[root@localhost ~]#sed -i 's#^ServerActive.*$#ServerActive=zabbix服务器IP#' /opt/zabbix/etc/zabbix_agentd.conf
[root@localhost ~]#sed -i '103aListenPort=10050' /opt/zabbix/etc/zabbix_agentd.conf
复制服务启动脚本
[root@localhost ~]#cp /root/zabbix-4.2.1/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@localhost ~]#sed -i 's#BASEDIR=.*$#BASEDIR=/opt/zabbix#' /etc/init.d/zabbix_agentd
[root@localhost ~]#systemctl daemon-reload
[root@localhost ~]#systemctl stop zabbix_agentd
[root@localhost ~]#systemctl status zabbix_agentd
[root@localhost ~]#vim /opt/zabbix/etc/zabbix_agentd.conf
启动服务
[root@localhost ~]#/etc/init.d/zabbix_agentd start
Starting zabbix_agentd (via systemctl): [ OK ]
[root@es02 zabbix]# ps -aux |grep zabbix
zabbix 10569 0.0 0.0 21204 744 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd
zabbix 10571 0.0 0.0 21204 936 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 10572 0.0 0.0 21204 484 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 10573 0.0 0.0 21204 484 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 10574 0.0 0.0 21204 484 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 10575 0.0 0.0 21204 884 ? S 19:55 0:00 /opt/zabbix/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 10580 0.0 0.0 112680 700 pts/0 S+ 19:55 0:00 grep --color=auto zabbix