# Installing pre-compiled Zabbix agent binaries
- Download zabbix agent tar package.
~]$ wget https://cdn.zabbix.com/zabbix/binaries/stable/7.0/7.0.23/zabbix_agent-7.0.23-linux-3.0-amd64-static.tar.gz |
- Create zabbix user.
~]$ sudo groupadd zabbix -g 201 | |
~]$ sudo useradd -M -r -g zabbix -u 201 -s /bin/false zabbix |
- Copy binary files.
~]$ tar xf zabbix_agent-7.0.23-linux-3.0-amd64-static.tar.gz | |
~]$ sudo cp sbin/zabbix_agentd /usr/sbin/ | |
~]$ sudo cp bin/* /usr/sbin/ |
- Create the agent configuration file.
~]$ sudo mkdir /etc/zabbix | |
~]$ sudo cp conf/zabbix_agentd.conf /etc/zabbix/ | |
~]$ sudo tee /etc/zabbix/zabbix_agentd.conf << EOF | |
Server=192.168.3.227 | |
ServerActive=192.168.3.227:10051 | |
Hostname=fedora | |
LogFile=/tmp/zabbix_agent.log | |
EOF |
- Create a service unit.
~]$ sudo tee /usr/lib/systemd/system/zabbix-agent.service << "EOF" | |
[Unit] | |
Description=Zabbix Agent | |
After=syslog.target | |
After=network.target | |
[Service] | |
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf" | |
EnvironmentFile=-/etc/sysconfig/zabbix-agent | |
Type=forking | |
KillMode=control-group | |
ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE | |
ExecStop=/bin/kill -SIGTERM $MAINPID | |
RestartSec=10s | |
User=zabbix | |
Group=zabbix | |
[Install] | |
WantedBy=multi-user.target | |
EOF | |
~]$ sudo systemctl daemon-reload | |
~]$ sudo systemctl enable zabbix-agent --now |
- Allow port 10050 on firewall.
~]$ sudo firewall-cmd --zone=public --add-port=10050/tcp --permanent | |
~]$ sudo firewall-cmd --reload |