Wazuh for a few Linux servers: what you really need
Wazuh's quick start installs three big parts and asks for 8 GB of memory. For a few web servers, you can start with one small part: the Wazuh server. Here's how, step by step, and what you can skip.
The parts of Wazuh
Wazuh has four parts. You don't need all of them:
| Part | What it does | For a few servers |
|---|---|---|
| Agent | Runs on each server, watches files and logs, sends what it sees | Needed (about 55 MB of memory in our test) |
| Wazuh server (manager) | Receives the reports, checks them against its rules, writes alerts | Needed (about 300 MB of memory and 1.3 GB of disk after install) |
| Indexer | A search database for alerts | Optional |
| Dashboard | A web page to search the alerts and see charts | Optional (needs the indexer) |
The indexer and dashboard are what make the full install heavy. Without them, the Wazuh server still writes every alert to a file, one alert per line, that you can read and filter. We'll do that in step 6.
The cost: without the indexer, you have no search page and no charts, and Wazuh's scan for known software weaknesses ("vulnerability detection") doesn't work, because it stores its results there. Keep your packages up to date instead (see automatic security updates).
Before you start
- A spare Debian or Ubuntu machine for the Wazuh server, with 2 GB of memory or more, and room for the alerts to grow (see step 7).
- Don't put the Wazuh server on a web server you are watching. A machine can be a Wazuh server or have the agent, not both.
- All servers must run the same Wazuh version, or an older agent. An agent newer than its Wazuh server can't connect. That's why we stop automatic updates below.
1. Install the Wazuh server
On the Wazuh server machine, add Wazuh's package source and install only the manager:
sudo apt install -y curl gnupg
curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | sudo gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import
sudo chmod 644 /usr/share/keyrings/wazuh.gpg
echo "deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main" | sudo tee /etc/apt/sources.list.d/wazuh.list
sudo apt update
sudo apt install -y wazuh-manager
sudo apt-mark hold wazuh-manager
apt-mark hold stops the Wazuh server from updating together with your other packages. You update it on purpose, before the agents.
2. Tell it there is no indexer
The settings are in /var/ossec/etc/ossec.conf. Out of the box, the Wazuh server tries to send alerts to an indexer. Turn that off, and turn off vulnerability detection, which needs the indexer:
sudo sed -i '/<indexer>/,/<\/indexer>/s/<enabled>yes<\/enabled>/<enabled>no<\/enabled>/' /var/ossec/etc/ossec.conf
sudo sed -i '/<vulnerability-detection>/,/<\/vulnerability-detection>/s/<enabled>yes<\/enabled>/<enabled>no<\/enabled>/' /var/ossec/etc/ossec.conf
Both blocks should now say <enabled>no</enabled>. Check with grep -A2 -E "<indexer>|<vulnerability-detection>" /var/ossec/etc/ossec.conf.
3. Ask for a join password
By default, any machine that can reach the Wazuh server can join it as an agent. A join password stops that. In the <auth> block, switch use_password to yes and save a long random password:
sudo sed -i '/<auth>/,/<\/auth>/s/<use_password>no<\/use_password>/<use_password>yes<\/use_password>/' /var/ossec/etc/ossec.conf
openssl rand -base64 24 | sudo tee /var/ossec/etc/authd.pass
sudo chown root:wazuh /var/ossec/etc/authd.pass
sudo chmod 640 /var/ossec/etc/authd.pass
sudo systemctl enable --now wazuh-manager
Keep the password somewhere safe; you need it once per server in step 5. In our test, an agent with a wrong password got Invalid password. Unable to add agent and was not added.
4. Open two ports, on the Wazuh server only
Agents connect to the Wazuh server on TCP port 1515 to join and 1514 to send reports. Both are encrypted by Wazuh. Open them only to your own servers. With ufw:
sudo ufw allow from 203.0.113.10 to any port 1514,1515 proto tcp
sudo ufw allow from 203.0.113.11 to any port 1514,1515 proto tcp
Use your servers' addresses instead of the examples. The servers you watch need no open ports: their agents only connect out. You don't need port 55000 (the Wazuh API) either; it's for the dashboard.
5. Install the agent on each server
On Ubuntu or Debian, add the same package source as in step 1, then install the agent with the Wazuh server's address and the join password:
sudo WAZUH_MANAGER="wazuh.example.com" WAZUH_REGISTRATION_PASSWORD="the-join-password" apt install -y wazuh-agent
sudo apt-mark hold wazuh-agent
sudo systemctl enable --now wazuh-agent
On Rocky, AlmaLinux or other RHEL-like systems:
sudo rpm --import https://packages.wazuh.com/key/GPG-KEY-WAZUH
sudo tee /etc/yum.repos.d/wazuh.repo <<'EOF'
[wazuh]
name=Wazuh
baseurl=https://packages.wazuh.com/4.x/yum/
gpgcheck=1
gpgkey=https://packages.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
EOF
sudo WAZUH_MANAGER="wazuh.example.com" WAZUH_REGISTRATION_PASSWORD="the-join-password" dnf install -y wazuh-agent
sudo sed -i 's/^enabled=1/enabled=0/' /etc/yum.repos.d/wazuh.repo
sudo systemctl enable --now wazuh-agent
The last sed turns the Wazuh package source off again, so dnf upgrade can't install a newer agent than your Wazuh server.
The password is only used once, to join. Then check the agent's log: sudo grep -E "Valid key|Connected" /var/ossec/logs/ossec.log should show Valid key received and Connected to the server. On the Wazuh server, sudo /var/ossec/bin/agent_control -l lists it as Active.
6. Watch your website files
The agent checks system folders like /etc and /usr/bin twice a day out of the box. For websites, you want to know straight away. Add your web folder inside the <syscheck> block of the agent's /var/ossec/etc/ossec.conf:
<directories realtime="yes" check_all="yes">/var/www</directories>
<ignore type="sregex">/var/www/[^/]+/(storage|cache|tmp|sessions)/</ignore>
The ignore line skips folders that change all the time; adjust it to your apps. Restart with sudo systemctl restart wazuh-agent.
To test, we added a PHP file to an upload folder and changed index.php. Both showed up on the Wazuh server within seconds. Read the newest file alerts there with jq:
sudo apt install -y jq
sudo jq -r 'select(.rule.groups|index("syscheck")) | [.timestamp[0:19], .rule.level, .agent.name, .syscheck.path, .rule.description] | @tsv' /var/ossec/logs/alerts/alerts.json | tail
Our test printed:
2026-11-16T17:06:05 5 web1 /var/www/shop/uploads/x.php File added to the system.
2026-11-16T17:06:05 7 web1 /var/www/shop/index.php Integrity checksum changed.
To see only the serious alerts from all checks, filter by level. Wazuh levels go from 0 to 15; 7 and up is a good start, 12 and up is "look now":
sudo jq -r 'select(.rule.level >= 7) | [.timestamp[0:19], .rule.level, .agent.name, .rule.description] | @tsv' /var/ossec/logs/alerts/alerts.json | tail -20
Expect a burst on day one. When an agent first starts, Wazuh's built-in configuration checks (called SCA) compare the server with a CIS security benchmark. On our fresh Rocky server, that made 144 alerts of level 7 like "Ensure inactive password lock is 30 days or less". They are advice about system settings, not attacks. Read them once, fix what makes sense, and they only come back when a result changes. If you don't want them at all, set <enabled>no</enabled> in the agent's <sca> block. To hide them in the commands above, add select(.rule.groups|index("sca")|not) | at the start of the filter.
Wazuh can also send alerts by email (the <email_notification> setting), but the server then needs a working mail setup. It is off by default; out of the box, only alerts of level 12 and up would be emailed.
7. Keep the disk in check
Every day, the Wazuh server moves the day's alerts into /var/ossec/logs/alerts/<year>/<month>/ and compresses them. It doesn't delete old ones. Keep 90 days with a daily job:
echo '30 3 * * * root find /var/ossec/logs/alerts /var/ossec/logs/archives -type f -mtime +90 -delete' | sudo tee /etc/cron.d/wazuh-cleanup
Check the size from time to time with sudo du -sh /var/ossec/logs. A noisy rule, like a cache folder you forgot to ignore, is the usual reason it grows fast.
What you can skip for now
- Indexer and dashboard: add them later if you want a search page. Your agents keep working.
- Active response (Wazuh blocking addresses by itself): fail2ban already does this well for logins. See fail2ban on Ubuntu and Debian.
- Watching everything: start with your web folders. Every extra folder means more alerts to read.
Official sources
- Wazuh docs: architecture, installing the Wazuh server, installing the agent
- Wazuh: joining with a password
- Wazuh: file integrity monitoring and the syscheck settings
- Wazuh: alert management
ServerNest can set up a full Wazuh server for you, with the search database and dashboard that this guide leaves out. That needs a server with 8 GB of memory. ServerNest connects your servers, watches each app's files and emails the alerts that matter. It comes with the Pro and Unlimited plans, and with any plan in an organization set to security monitoring only: one that uses ServerNest just for Wazuh, with no sites or databases (how that works). How it works in ServerNest · Sign up.