Helper scripts for installing and managing Wazuh agents on Linux and macOS.
These utilities simplify deployments, standardize installation steps, and reduce configuration errors across environments.
-
wazuh-agent-linux-install.sh
Installs the Wazuh agent on supported Linux distributions. -
wazuh-agent-macos-install.sh
Installs or uninstalls the Wazuh agent on macOS.
Before using the scripts:
- A reachable Wazuh Manager (IP or hostname)
- Root or sudo privileges
- (Optional) Enrollment password or group configuration
You can either use a one-liner install (recommended for most cases) or clone the repository manually.
Run directly from the CLI without cloning the repo.
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashor with wget:
wget -qO- https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashInstall:
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-macos-install.sh | sudo bash -s installUninstall:
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-macos-install.sh | sudo bash -s uninstallThe installation scripts support environment variables to allow fully automated deployments without interactive prompts.
This is recommended when deploying agents through:
- automation tools (Ansible, Terraform, etc.)
- MDM platforms
- provisioning scripts
- CI/CD pipelines
| Variable | Description |
|---|---|
WAZUH_MANAGER |
Wazuh manager or worker hostname/IP |
WAZUH_REGISTRATION_SERVER |
Server used for agent enrollment |
WAZUH_AGENT_NAME |
Name assigned to the agent |
WAZUH_AGENT_GROUP |
Group assigned during enrollment |
WAZUH_REGISTRATION_PASSWORD |
Enrollment password (if enabled) |
WAZUH_MANAGER=worker1.soc.local \
WAZUH_REGISTRATION_SERVER=worker1.soc.local \
WAZUH_AGENT_GROUP=linux \
WAZUH_AGENT_NAME=$(hostname) \
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashor using wget:
WAZUH_MANAGER=worker1.soc.local \
WAZUH_REGISTRATION_SERVER=worker1.soc.local \
WAZUH_AGENT_GROUP=linux \
WAZUH_AGENT_NAME=$(hostname) \
wget -qO- https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashsudo WAZUH_MANAGER=worker1.soc.local \
WAZUH_REGISTRATION_SERVER=worker1.soc.local \
WAZUH_AGENT_GROUP=macos \
WAZUH_AGENT_NAME=$(scutil --get ComputerName) \
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-macos-install.sh | sudo bash -s installWhen WAZUH_REGISTRATION_SERVER is defined:
- The agent performs enrollment (port 1515) with the specified server.
- The server registers the agent in the Wazuh cluster.
- The agent then establishes the event communication (port 1514) with the manager defined in
WAZUH_MANAGER.
In clustered environments this allows directing agent registrations to specific worker nodes.
Example DNS architecture:
agents-linux.soc.local -> worker1
agents-macos.soc.local -> worker2
agents-windows.soc.local -> worker3
Installation example:
WAZUH_MANAGER=agents-linux.soc.local \
WAZUH_REGISTRATION_SERVER=agents-linux.soc.local \
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashThis approach allows:
- distributing agent load across workers
- simplifying deployment automation
- improving cluster scalability
git clone https://github.com/cloudfence/wazuh-utils.git
cd wazuh-utilsMake the scripts executable if needed:
chmod +x wazuh-agent-*.shThis script automates:
- Adding the Wazuh package repository
- Installing the Wazuh agent
- Configuring the manager connection
- Enabling and starting the agent service
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-linux-install.sh | sudo bashor, after cloning the repo:
sudo ./wazuh-agent-linux-install.shYou may be prompted for:
- Manager IP/hostname
- Agent name
- Agent group
- Enrollment password
sudo systemctl status wazuh-agentDebian/Ubuntu
sudo systemctl stop wazuh-agent
sudo apt-get remove --purge wazuh-agent
sudo rm -rf /var/ossecRHEL/CentOS/Rocky/Alma
sudo systemctl stop wazuh-agent
sudo yum remove -y wazuh-agent
sudo rm -rf /var/ossecManages installation and removal of the Wazuh agent on macOS.
curl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-macos-install.sh | sudo bash -s installor, after cloning the repo:
sudo ./wazuh-agent-macos-install.sh installcurl -s https://raw.githubusercontent.com/cloudfence/wazuh-utils/main/wazuh-agent-macos-install.sh | sudo bash -s uninstallor, after cloning the repo:
sudo ./wazuh-agent-macos-install.sh uninstallsudo /Library/Ossec/bin/wazuh-control statusDepending on version, macOS may require:
- Approving installer in System Settings → Privacy & Security
- Allowing system extensions
Check service:
sudo systemctl status wazuh-agent
sudo /Library/Ossec/bin/wazuh-control statusTest connectivity:
ping <manager-ip>View logs:
sudo tail -n 50 /var/ossec/logs/ossec.logEnsure agent version is equal to or lower than the manager version.
Set proxy if needed:
export http_proxy=http://proxy:port
export https_proxy=http://proxy:portUse offline packages when required.