On Ubuntu/Debian Zabbix-agent installs quite easily.
Initially, just enter the installation command:
sudo apt install zabbix-agent
And slightly modify the configuration file /etc/zabbix/zabbix_agentd.conf
Namely indicate:
LogFileSize=1 (log file size in megabytes)
EnableRemoteCommands=1 (allow the execution of commands on the Zabbix system by the server)
Server=192.168.1.11 and ServerActive=192.168.1.11 (ip address of the remote Zabbix server)
Hostname=name (same as hostname of the current system)
ListenIP=192.168.1.1 (if the system has several network interfaces with different IP addresses and it is necessary for the zabbix agent to work on a specific one, and not all, then we will indicate it)
You can edit the configuration file, for example, with the standard text editor nano (in which Ctrl+O and Enter serves to save the changes, and Ctrl+X to exit).
An example of opening a file in a nano text editor:
sudo nano /etc/zabbix/zabbix_agentd.conf
If there are many IP addresses on the server, and zabbix-agent should work on one, but not all, then we will indicate it:
ListenIP=192.168.0.5
Restart the Zabbix agent for the changes in the configuration file to take effect:
sudo /etc/init.d/zabbix-agent restart
You can see on which network interfaces the zabbix-agent is running like this:
sudo netstat -tulpn | grep :10050
If you want the zabbix agent to run as root, then specify root in the file /etc/default/zabbix-agent.
Check if zabbix-agent starts up after restarting the system and, if necessary, activate autorun:
sudo systemctl is-enabled zabbix-agent.service
sudo systemctl enable zabbix-agent.service
If iptables is used, then we add two rules (you can also add to the rules, for example -s 192.168.0.20, if you need to allow connection to the agent only from specific IP addresses):
sudo iptables -A INPUT -s 192.168.0.20 -p tcp --dport 10050 -j ACCEPT
sudo iptables -A INPUT -s 192.168.0.20 -p tcp --dport 10051 -j ACCEPT
See also my articles:
Zabbix installation on Ubuntu from distribution packages
Examples of Items for Zabbix