Deploying Wazuh agents on Linux systems

The agent runs on the host you want to monitor and communicates with the Wazuh manager, sending data in near real time through an encrypted and authenticated channel.

The deployment of a Wazuh agent on a Linux system uses deployment variables that facilitate the task of installing, registering, and configuring the agent. Alternatively, if you want to download the Wazuh agent package directly, see the packages list section.

Note

To execute all the commands, root user privileges are required.

Add the Wazuh repository

Add the Wazuh repository to download the official packages.

  1. Import the GPG key:

    # rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
    
  2. Add the repository:

    # cat > /etc/yum.repos.d/wazuh.repo << EOF
    [wazuh]
    gpgcheck=1
    gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
    enabled=1
    name=EL-\$releasever - Wazuh
    baseurl=https://packages.wazuh.com/4.x/yum/
    protect=1
    EOF
    

Deploy a Wazuh agent

  1. To deploy the Wazuh agent to your system, select your package manager and edit the WAZUH_MANAGER variable to contain your Wazuh manager IP address or hostname.

    # WAZUH_MANAGER="10.0.0.2" yum install wazuh-agent-4.1.5-1
    

    For additional deployment options such as agent name, agent group, and registration password, see the Deployment variables for Linux section.

    Note

    Alternatively, if you want to install an agent without registering it, omit the deployment variables. To learn more about the different registration methods, see the Registering Wazuh agents section.

  2. Enable and start the Wazuh agent service.

# systemctl daemon-reload
# systemctl enable wazuh-agent
# systemctl start wazuh-agent

The deployment process is now complete and the Wazuh agent is successfully running on your Linux system.

  • Recommended action - Disable Wazuh updates

    Compatibility between the Wazuh agent and the Wazuh manager is guaranteed when the Wazuh manager version is later than or equal to that of the Wazuh agent. Therefore, we recommend disabling the Wazuh repository to prevent accidental upgrades. To do so, use the following command:

    # sed -i "s/^enabled=1/enabled=0/" /etc/yum.repos.d/wazuh.repo
    

Uninstall a Wazuh agent

To uninstall the agent, select your package manager and run the following command.

# yum remove wazuh-agent

Some files are marked as configuration files. Due to this designation, the package manager does not remove these files from the filesystem. If you want to completely remove all files, delete the /var/ossec folder.

The Wazuh agent is now completely removed from your Linux system.