Deploying Wazuh agents on Linux with deployment variables

Learn how to install and enroll Wazuh Linux agents automatically with environment variables for manager address, enrollment password and group, and make the rollout repeatable.

On this page

Why Linux teams use deployment variables to roll out Wazuh agents

When a fleet of Linux hosts needs the Wazuh agent, the goal is to install and enroll every host without a manual step on each one. Deployment variables make that possible. They are environment variables set on the host before the agent package installs, and they tell the installer which Wazuh server to report to, the password used to enroll, and which agent group the host should join. The agent then starts and registers on its own. Wazuh agents run on Linux as well as Windows, macOS, Solaris, AIX and HP-UX, so this method is one of several installation paths for the same agent, and the Linux package and its variables are the part that matters for your hosts.

This method fits best when hosts are built from a repeatable image, configuration management tool or provisioning script, and when the same manager address and group apply to a large batch of machines. A manual install suits a handful of hosts, a lab, or a one-off host that needs a different group or manual review of each step. Before you rely on variables, confirm the exact variable names, the first-run behavior the agent follows, and the enrollment options for your release line in the current Wazuh documentation for 4.14, because names and defaults can change between releases. Use the Wazuh deployment options page as the starting point for that check.

Deployment variables only handle the first registration. After that, the Wazuh server manages agent configuration and can upgrade agents remotely, so the enrollment script does not need to carry settings that will change later. Plan the script so it stays small: it should install the package, set the enrollment values for that host class and leave ongoing configuration to the server. Decide early who holds the enrollment password, how it is stored and rotated, and how the script is tested on a non-production host before it runs across the fleet.

Which enrollment inputs to set during installation

This table compares the four inputs an installer can supply on a Linux agent: manager address, enrollment password, agent group and agent name, plus the option to enroll later through the server API. Read each row against your fleet type, because the right choice depends on how many hosts you build, whether images are cloned, and where secrets are allowed to live. Confirm the exact variable names in the current Wazuh agent installation documentation before writing any script.

InputWhen it fitsTrade-off
Manager addressStatic fleets and single-manager or clustered environments where every host reaches the same agent endpoint. Set it at install time so the agent connects on first start.Hard-coding the address in a script or image ties the build to one server. Plan a change process if the manager or load balancer address moves.
Enrollment passwordAutomated rollouts through configuration management, where the installer must register the agent without a manual step. Useful when the manager requires password-based registration.The password sits in scripts, package repositories or automation variables. Keep it in a secrets store, restrict who can read the deployment job, and rotate it after exposure.
Agent groupFleets split by role, such as web, database or jump host, so each agent receives the right configuration on first check-in. Assign at install time when the role is known at build.Group names baked into a golden image become wrong when a host changes role. Confirm group existence on the manager first, or the assignment will not behave as expected.
Agent nameHosts with predictable naming that must match asset records. Set it when the hostname is known at build time, for example through a provisioning step.Cloned images that share a name cause duplicate or conflicting agents. Derive names from the host at first boot instead of from the image.
Enroll later through the server APIGolden images, restricted networks where port 1515 is closed, and automation that cannot pass secrets into package installs. Keys are requested and imported after the host is in its final state.Requires an extra workflow step and API credentials managed by the deployment tooling. Confirm the enrollment procedure in the server API documentation before adopting it.

How to script a repeatable Linux agent install

This sequence takes a Linux host from an unconfigured state to an enrolled, grouped Wazuh agent using deployment variables, so the same script can run across a pilot group and then the fleet. Each step ends with a check that confirms the result before the next step starts.

  1. Confirm the release line and package source

    The platform team confirms which Wazuh release line the manager runs and pins the agent package to the same line, typically 4.14 for the current series. They add the Wazuh package repository for the distribution, or an internal mirror if hosts have no internet access, and record the exact package version in the change record. Done means that the manager and a test host report matching major and minor versions, and that the package manager lists the expected version as available from the repository.

  2. Prepare the manager address and enrollment credentials

    The team records the manager address that agents will use and confirms that the enrollment port is reachable from the test host, as the Wazuh documentation describes for registration. The enrollment password goes into a secrets manager or a root-only file, never into the script body or a shared repository. Done means a connection test from the test host to the manager succeeds and the password is retrievable only by the deployment pipeline.

  3. Set deployment variables on one test host

    On a single test host, the engineer exports the deployment variables the package installer reads, including WAZUH_MANAGER for the manager address, WAZUH_REGISTRATION_PASSWORD for enrollment, and WAZUH_AGENT_GROUP for the initial group. The group must already exist on the manager, so the engineer confirms that first. Done means the variables are set in the session, the group name matches the manager, and the password does not appear in shell history or process listings.

  4. Install the agent package with variables

    The engineer runs the install with the chosen package manager, such as apt-get on Debian-based systems or dnf or yum on Red Hat-based systems, and passes the variables in the same command so the installer can write the manager settings during installation. The script writes output to a log file for later review. Done means the package installs without errors and the installed version matches the version recorded in the first step.

  5. Start and enable the agent service

    The engineer enables and starts the wazuh-agent service with systemd, then checks the agent log under the Wazuh installation directory for lines showing a connection to the manager and a successful enrollment. Errors in this log usually point to a wrong address, a password mismatch or a blocked port. Done means the service reports active, the log shows an enrollment entry, and the service is enabled to start after a reboot.

  6. Verify enrollment in the dashboard or API

    The engineer confirms in the Wazuh dashboard agents view, or through the server API, that the test host appears with an active status and the expected group. The agent name and the group must match what the script set. Done means the agent is listed as active with the correct group, and the check can be repeated by a script that queries the same API, so verification does not depend on a person looking at the dashboard.

  7. Run a pilot group before fleet rollout

    The team runs the script on a small pilot set that covers each distribution, service role and network zone in use, and holds the fleet rollout until every pilot agent meets the checks above. Findings from the pilot usually concern package repositories, firewall rules or group names, and the team fixes them in the script before wider use. Done means every pilot agent is active, in the intended group, and reports the expected version, with no unexplained errors in the logs.

  8. Make the script safe to rerun on rebuilt hosts

    The script checks whether the agent package is already installed and whether the service is running before it changes anything, so a rerun on a configured host makes no changes. Golden images and cloned hosts must not carry an existing agent key, because duplicate keys cause conflicts on the manager. The team clears the key on image build or at first boot, and confirms that removed or rebuilt hosts do not leave stale entries behind. Done means a second run reports no changes and a rebuilt host registers as its own agent.

How the install-time variables interact with groups and agent keys

The install-time variables matter at the agent's first start, when it registers with the Wazuh server. The manager address and enrollment password (set through WAZUH_MANAGER and WAZUH_REGISTRATION_PASSWORD) give the agent what it needs to request registration. The server then creates an agent record, issues a unique ID and key, and the agent stores that key locally in its client keys file. From that point on, the agent authenticates with its key, so the enrollment password identifies the request, not the host. Confirm in the documentation for your release whether the password stays in the package configuration after enrollment and how your team rotates it. Treat the key as the host's identity, because duplicate or stale keys cause most enrollment problems later.

Group assignment is the second decision made at registration. The group variable (WAZUH_AGENT_GROUP) places the agent in one or more groups on the server, and each group determines which centrally managed configuration the agent receives. The server builds the shared and group-specific agent.conf content and distributes it to matching agents, which then apply the updated configuration without a reinstall. This means a change made on the server reaches every agent in the group, so the group design should be settled before the install script is written. Confirm how a later server-side group change interacts with the variable on the next re-registration, and keep the group names in the same source control as the script so the two cannot drift apart.

Reinstalled and cloned hosts need the most care. An agent's identity is its key, so a rebuilt host that keeps the old key may present an identity the server already holds, while a host that loses its key registers as a new agent and leaves the old record behind. Cloning a disk image that already contains a key produces two machines with the same identity, which the server can reject or cause to alternate between records. Before you capture a golden image, confirm with your Wazuh version how the server handles duplicate names and keys, whether re-registration reuses an existing record, and which files must be cleared first. Then add a check after each rebuild that every host has exactly one active agent record.

Securing the enrollment password and the install pipeline

Deployment variables make agent installs fast, but they also put an enrollment credential and a package into your automation. The cards below cover the four risks that tend to matter most and the control that addresses each one. Work through them before the first production rollout, then repeat the checks whenever the script or the pipeline changes.

Enrollment secrets exposed in scripts

When WAZUH_REGISTRATION_PASSWORD is written into a shell script, a configuration management manifest or a CI log, anyone who can read that material can register a rogue host. Keep the enrollment password out of source control and out of the command line where possible, and pull it from a secrets manager at install time. Check that your pipeline masks the value in logs and that the install script does not echo its environment. Then ask whether the enrollment password is the only credential that can register agents, since that determines how much a leak allows.

Shell history and configuration logs

Commands typed directly on a host can land in shell history, and configuration management tools can record task arguments in run logs or reports. A password that appears once in a log may be copied into tickets, backups and support bundles. Prefer a script that reads the secret from a file or environment injected by the pipeline, set history controls for interactive sessions, and mark sensitive tasks so the tool suppresses their output. Confirm the behavior with your own tool, because defaults differ between versions.

Packages from unverified sources

An agent package that comes from an unofficial mirror, a copied file share or an unchecked download can run with root privileges on every host it reaches. Pull packages only from the Wazuh repository or from an internal mirror you have populated from it, and verify the package signature before installation. Pin the version your change process approved, so the pipeline cannot pick up an unreviewed build. Record the checksum or signature result in the deployment log so an auditor can trace what was installed.

Wazuh release notes

Agents enrolling to the wrong manager

A variable set incorrectly, or a script reused from another environment, can point production hosts at a test manager or a manager outside your trust boundary. Set the manager address per environment from a reviewed inventory, not from a default in the script. Add a post-install check that confirms the agent reports to the expected manager and appears in the expected group. Ask who can change the manager address and group variables, and require the same review you apply to the package itself.

Cloned images carrying stale identities

A golden image that already contains an agent key can make every clone present the same identity, which causes key conflicts and misattributed alerts. Build images without an enrolled agent, or clear the agent state during image preparation, and let each host enroll on first boot. Limit who can enroll agents from the image pipeline, and rotate the enrollment credential when staff with access change. Check after each rebuild that hosts show unique names and identities in the manager.

Questions teams ask before automating Wazuh agent rollout

Does Wazuh cost anything to run on Linux endpoints?

The self-hosted Wazuh software is open source and carries no license fee, so for self-hosted use the cost is labor and infrastructure. Wazuh is distributed under the GNU General Public License version 2, with an exception that permits linking with OpenSSL, and you should read the Wazuh LICENSE file with your legal team. Plan for the people who design the deployment variables, test them, and maintain the scripts, plus the manager, indexer and dashboard hosts you run. Wazuh Cloud is a separate, managed service with its own paid tiers, so confirm which model you are pricing before you compare quotes.

What drives the effort of automating a Linux agent rollout?

Effort rises with fleet size, the number of distributions and package managers in use, how enrollment passwords are stored and delivered, and how much testing the change needs. A single distribution with one configuration management tool is a small job. A mixed fleet across several Linux families, with containers, golden images and hosts in restricted network zones, needs more variants, more test runs and more exception handling. Secrets handling also adds work, because the enrollment password must reach the installer without appearing in shell history, logs or unprotected files. Ask any provider to break the estimate down by platform, by secret mechanism and by test matrix.

Should we pilot the script on a small group of hosts first?

Yes. A pilot group lets you confirm that the manager address, enrollment password and group assignment work on real hosts before the script touches the whole fleet. Choose hosts that represent each distribution, each network zone and each role, including at least one host that is hard to reach or rebuilt often. Record what the agent reports after install, whether it appears under the intended group and whether the package upgrades cleanly on a second run. If a pilot fails, you can roll back a few hosts without an emergency change across thousands of systems.

What access does our team need before a partner can start?

Your team needs to give the work access to the Wazuh manager, the package source and the change windows. On the manager side, that means enough rights to confirm agent enrollment settings, groups and the registration service, and to read the agent list without changing production data. For the package source, you need the repository or mirror the hosts use, plus signing keys and the version you have approved. Change windows matter because enrollment touches production hosts, so agree which windows are allowed, who approves them and how a rollback is requested. Written access terms should appear in the scope before work starts.

Can our own team do this without outside help?

Often yes, if you already run configuration management, package repositories and a Wazuh deployment. The work is well documented and the core steps are a package install with environment variables, followed by a check that the agent enrolled and joined the right group. The harder parts are the ones that repeat across a large fleet: secrets delivery, idempotent reruns, handling hosts that already have an agent, and testing each distribution. Teams without a dedicated platform or security engineer often find that the first rollout takes longer than expected because of these edge cases. A partner is useful when you need the scripts, testing and runbook delivered as a fixed scope.

How do we keep the enrollment password out of scripts and logs?

Do not place the enrollment password directly in a script that lives in version control or in a shared document. Instead, retrieve it at install time from your secrets manager or from a short-lived file that your configuration tool writes with restricted permissions, then remove it after enrollment. Check that the install command does not echo the value into logs or process listings, and that your automation tool masks it. Review how the manager stores and accepts the password, and confirm the approach with your security team. The Wazuh hardening documentation covers agent enrollment security, so use it as the checklist for this review.

What should we check after the script runs on each host?

Check that the agent service is running, that the host appears in the Wazuh agent list with the expected name and group, and that it reports events to the manager. Also confirm that a second run of the same script does not create a duplicate agent or overwrite the configuration unexpectedly. Keep a short record of the package version, the manager address and the group for each host so you can prove what was deployed. Repeat these checks after any change to the script, the manager or the distribution mix, and include them in your change record so auditors and operations staff can trace the result.

How a Linux host moves from package install to enrolled agent

The flow starts with configuration management or a script setting the deployment variables, then the package manager installs the agent on the host. When the agent starts, it sends an enrollment request across the trust boundary to the Wazuh server, which assigns the agent to its group. The host then receives its configuration, and the agent appears in the Wazuh dashboard. Check each hand-off in order, because a failure at enrollment shows up later as a missing or unassigned agent.

Enrollment path from package install to dashboard, with the host and manager network separated.

Keeping the rollout repeatable after the first hosts enroll

The first enrollment proves the script works once. The harder job is keeping every later run, and every later host, producing the same agent version, the same manager address and the same group membership. Start by pinning the agent package version in the script rather than letting each run pull whatever is current. Wazuh's 4.14 line has shipped patch releases roughly every one to two months, with 4.14.9 released on 14 October 2026 (see the Wazuh release notes). Decide which patch level your fleet runs, test that exact version on a small host group, and then promote it deliberately. Confirm in your own package repository how the pinned version is selected on each distribution, because pinning syntax differs between package managers.

Re-running the script on new hosts should be a routine action, not a rebuild. Before each run, confirm that the manager address, enrollment password source and group names still match the live server, since a changed value can enroll hosts into the wrong group without any error. After maintenance windows, reboots or agent upgrades on existing hosts, check that each agent reports as active on the manager and that the expected group appears in its record. Keep the script in version control with a reviewed change history, and store the enrollment secret outside the file itself. Treat changes to the script as changes to production configuration.

Upgrading agents is a separate topic, and so is removing decommissioned or duplicate agents from the agent list. Those steps are covered in the related pages on upgrades and on removing and cleaning up Wazuh agents. Until those pages apply, leave the pinned version and enrollment settings unchanged on hosts already in service, and confirm the expected behavior in your own environment first.

How the approach changes for cloud, data center and air-gapped hosts

Cloud instances usually receive the agent through a managed image or an instance bootstrap script, and the main risk is that the enrollment password ends up baked into an image that is copied many times. The install command stays the same, but the place where the variables are set and the identity that can read them need deliberate design. Enrollment also depends on network rules between subnets, security groups and any NAT or load balancer in front of the manager.

  • Package sourcing: Hosts pull the agent package from the Wazuh repository during first boot, so confirm that outbound access to that repository is allowed from each subnet or that you mirror the packages internally.
  • Secrets distribution: Prefer a cloud secrets store or instance identity to supply the enrollment password at boot, rather than placing it in a golden image or user data that any administrator can read.
  • Enrollment reachability: Confirm that instances can reach the manager on the enrollment and agent communication ports, including across VPCs, peering links and private endpoints.
  • Group assignment: Set the group variable per auto scaling group or launch template so new instances join the right agent group without manual steps.
  • Image hygiene: Build images before enrollment, and make sure the agent registration state is cleared so cloned instances do not share an identity.

Before rollout, test one instance from each launch template and confirm it appears once in the agent list under the expected group.

Scoping a Linux agent rollout with DeployOpen

A Linux agent rollout is usually a small technical task wrapped in a larger scoping problem. The install command with WAZUH_MANAGER, WAZUH_REGISTRATION_PASSWORD and WAZUH_AGENT_GROUP takes minutes on one host. Across a fleet, the work that determines success is deciding which hosts enroll, which group each one lands in, how the enrollment password is stored and rotated, and how the same script behaves on a Debian host, a RHEL host and a container base image. DeployOpen starts these engagements by inventorying operating system families and versions, package management and configuration management tools, network paths from each segment to the manager on port 1515, and the change windows your operations team allows.

A written scope should name the Wazuh components involved and who owns each one. The manager and indexer sit in infrastructure you control, so the scope must state which cluster or single node receives agents, how certificates are handled, and whether agents reach a load balancer or a fixed address. It should also cover the golden image question, since agents cloned from an image can carry a stale identity unless enrollment runs at first boot. Confirm the exact agent version you will pin against the current release line in the Wazuh release notes, and confirm how your team will test the deployment script against each target distribution before it reaches production.

Ask for a quote that separates the one-time work from what recurs. One-time items include building and testing the script, documenting group assignments, and proving enrollment on representative hosts. Recurring items include patching agents on the vendor's cadence, rotating the registration password, and reviewing agents that never report. DeployOpen prepares fixed-scope engagements from a written list of hosts, platforms and deliverables, and ongoing support can be handled as a retainer. Your side of the work is access to test hosts, a named owner for the manager, and a decision on who approves changes to the group mapping, because that decision drives how alerts and configuration reach each endpoint.

How DeployOpen works on this

DeployOpen plans, builds, documents and supports Linux agent rollouts inside your own infrastructure, so the enrollment method, manager address and group design are settled before any package reaches a production host. The work follows a written scope, a tested build and a handover your team can run without us.

How we scope

  • Inventory the Linux distributions, versions and host roles that the agent rollout must cover.
  • Confirm the manager address, enrollment password handling and whether port 1515 is reachable from every network segment.
  • Agree in writing which group names, configuration files and install scripts are in the deliverables.

How we build

  • Write a repeatable install script that sets deployment variables for manager, password and group during package installation.
  • Test the script on representative hosts, including one host per distribution family in your estate, before wider use.
  • Verify that each test host enrolls once, appears under the intended group and reports to the manager as expected.

How we hand over

  • Deliver the install script, variable reference, group design and a short runbook written for your operations team.
  • Document how to confirm enrollment, check agent status and remove a test agent cleanly from the manager.
  • Walk your engineers through the rollout steps and the known failure points so they can repeat the work independently.

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer when your team wants help after handover.
  • Plan agent upgrades alongside future Wazuh patch releases, which the vendor publishes roughly every one to two months.
  • Review the install script and group logic when your Linux images, packaging or manager layout change.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.