How to Install and Configure Zabbix Agents on Remote Linux
Continuing the Zabbix series, this tutorial will teach you how to install and configure the Zabbix agent on Linux (Debian-based systems and RHEL-based distros) to actively monitor local resources on remote systems.
The primary job of Zabbix agents includes collecting information locally from the targets where they run and sending the data to a central Zabbix server for further processing and analysis.
Request
Install and configure Zabbix on Debian/Ubuntu and CentOS / AlmaLinux.
Step 1: Install Zabbix Agents in Linux System
1. Depending on the Linux distribution you’re running, go to the Zabbix download page, get the latest version of the agent binaries available using a tool like wget or curl, and install it on your machine. your package using a distribution-specific package manager – Yum, Rpm, or Dpkg.
For Debian/Ubuntu systems use the following steps to download and install Zabbix Agent:
Installing the Zabbix Agent in Debian/Ubuntu
—————– On Debian 11 —————–
Zabbix 6.0 LTS version (supported until February, 2027) wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-1+debian$(cut -d"." -f1 /etc/debian_version)_all.deb dpkg -i zabbix-release_6.0-1+debian$(cut -d"." -f1 /etc/debian_version)_all.deb OR Zabbix 5.0 LTS version (supported until May 31, 2025) wget https://repo.zabbix.com/zabbix/5.0/debian/pool/main/z/zabbix-release/zabbix-release_5.0-2+debian$(cut -d"." -f1 /etc/debian_version)_all.deb dpkg -i zabbix-release_5.0-2+debian$(cut -d"." -f1 /etc/debian_version)_all.deb
—————– On Ubuntu —————–
Zabbix 6.0 LTS version (supported until February, 2027) wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb dpkg -i zabbix-release_6.0-1+ubuntu$(lsb_release -rs)_all.deb OR Zabbix 5.0 LTS version (supported until May 31, 2025) wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+$(lsb_release -sc)_all.deb dpkg -i zabbix-release_5.0-1+$(lsb_release -sc)_all.deb
apt update apt -y install zabbix-agent
Install Zabbix in RHEL/ Centos
For systems similar to RHEL/ Centos, download the .rpm package for the distribution-specific release number, use the same site as above, and install it using the rpm package manager.
To automatically manage missing dependency issues and install the agent using a single use, use the yum command followed by the binary package download link, as in the example below used to install the agent on CentOS 8:
. RHEL & Centos 7 / 8 / 9
Zabbix 6.0 LTS version (supported until February, 2027) rpm -Uvh https://repo.zabbix.com/zabbix/6.0/rhel/$(rpm -E %{rhel})/x86_64/zabbix-release-6.0-1.el$(rpm -E %{rhel}).noarch.rpm OR Zabbix 5.0 LTS version (supported until May 31, 2025) rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/$(rpm -E %{rhel})/x86_64/zabbix-release-5.0-1.el$(rpm -E %{rhel}).noarch.rpm
yum clean all yum -y install zabbix-agent
Step 2: Configure and Test the Zabbix Agent in Linux
2. The next logical step after installing packages on the system is to open the Zabbix agent configuration file located in /etc/zabbix/ system on both major distributions and instruct the program to send all the information Collected information is sent to the Zabbix server in order for analysis and processing.
Therefore, open the zabbix_agentd.conf file with your favorite text editor, find the below lines (use the screenshots as a guide), uncomment them, and make the following changes:
# nano /etc/zabbix/zabbix_agentd.conf
add Zabbix server IP address and hostname as shown below.
Server=IP of Zabbix Server ServerActive=IP of Zabbix Server Hostname=use the FQDN of the node where the agent runs
3. Once you’ve finished editing the Zabbix agent configuration file with the required values, restart the daemon using the following command, then use the netstat command to verify if the daemon has been started and operates on the specific port – 10050/tcp:
systemctl restart zabbix-agent netstat -tulpn|grep zabbix
For older distributions use the service command to manage the Zabbix agent daemon:
service zabbix-agent restart netstat -tulpn|grep zabbix
4. If your system is behind a firewall then you need to open 10050/tcp port on the system in order to reach through the Zabbix server.
For Debian based systems, including Ubuntu, you can use the ufw tool to open the port and on RHEL-based, you can use Firewalld utility to manage the firewall rules as the below examples:
ufw allow 10050/tcp [On Debian based systems]
firewall-cmd --add-port=10050/tcp --permanent [On RHEL based systems]
iptables -A INPUT -p tcp -m tcp --dport 10050 -j ACCEPT
5. Finally, in order to test if you can reach Zabbix Agent from Zabbix Server, use Telnet command from Zabbix server machine to the IP addresses of the machines that run the agents, as illustrated below (don’t worry about the thrown error from agents):
telnet zabbix_agent_IP 10050
Step 3: Add Zabbix Agent Monitored Host to Zabbix Server
6. On the next step it’s time to move to the Zabbix server web console and start adding the hosts which run zabbix agent in order to be monitored by the server.
Go to Configuration -> Hosts -> Create Host -> Host tab and fill the Hostname field with the FQDN of the monitored Zabbix agent machine, use the same value as above for the Visible name field.
Next, add this host to a group of monitored servers and use the IP Address of the monitored machine at the Agent interfaces field – alternatively you can also use DNS resolution if it’s the case. Use the below screenshots as a guide.
7. Next, move to the Templates tab and hit Select. A new window with templates should open. Choose Template OS Linux then scroll down and hit on Select button to add it and automatically close the window.
8. Once the template appears to Link the new template box, hit on Add text to link it to the Zabbix server, then hit on the lower Add button to finish the process and completely add the monitored host. The visible name of the monitored host should now appear host window.