Sunday, November 22, 2026
TR
LinuxOpen Source

Installing Wazuh on Ubuntu 24.04 and Migrating Data from an Old System

Installing Wazuh on Ubuntu 24.04 and Migrating Data from an Old System
Contents
  1. Project Purpose and Scope
  2. System Infrastructure
  3. Existing System (Source)
  4. Target System
  5. Quick Wazuh Installation
  6. Post-Installation State
  7. System Status Check
  8. Planning the Data Migration Process
  9. Data to Be Migrated
  10. Agent Information
  11. Data Backup and Transfer Process
  12. Step 1: Backup on the Old Server
  13. Backup Results
  14. Step 2: Packaging and Transferring the Data
  15. Applying the Data on the New Server
  16. Step 3: Stopping the Services
  17. Step 4: Transferring the Client Keys
  18. Client.keys Contents
  19. Step 5: Transferring Custom Rules and Decoders
  20. Step 6: Transferring the Agent Group Configurations
  21. Agent Group Configurations
  22. Configuration Validation and Starting the Services
  23. Configuration Check
  24. Starting the Services
  25. Agent Connection Problem and Its Solution
  26. Identifying the Problem
  27. Solution: Changing the IP Address
  28. Advantages:
  29. Results and Success Metrics
  30. Successfully Migrated Components
  31. System Status
  32. Lessons Learned and Recommendations
  33. Technical Takeaways
  34. Recommendations for Future Projects
  35. Conclusion

This article describes in detail the installation of the Wazuh SIEM system on Ubuntu 24.04 LTS, and how to migrate agent configurations, custom rules and other critical data from an existing Wazuh server to the new system.

Project Purpose and Scope

The main goals achieved in this work:

  • Installing Wazuh 4.12.0 on Ubuntu 24.04 LTS
  • Transferring data from the old Wazuh 4.3.6 system to the new system
  • Migrating the configurations required for 6 agents to keep working without interruption
  • Preserving custom security rules and decoders

System Infrastructure

Existing System (Source)

  • Operating System: Ubuntu (Ubuntu 18.04 LTS)
  • Wazuh Version: 4.3.6
  • IP Address: 192.168.100.100
  • Number of Agents: 6 active agents

Target System

  • Operating System: Ubuntu 24.04 LTS
  • Wazuh Version: 4.12.0
  • IP Address: 192.168.100.101 → 192.168.100.100 (After cutover)

Quick Wazuh Installation

The fastest way to install Wazuh on Ubuntu 24.04 was carried out using the installation assistant:

# System update
sudo apt update && sudo apt upgrade -y

# Download and run the Wazuh installation assistant
curl -sO https://packages.wazuh.com/4.12/wazuh-install.sh
sudo bash ./wazuh-install.sh -a

Post-Installation State

After the installation completed, the system gave the following output:

INFO: --- Summary ---
INFO: You can access the web interface https://<WAZUH_DASHBOARD_IP_ADDRESS>
User: admin
Password: <ADMIN_PASSWORD>
INFO: Installation finished.

System Status Check

The system status was checked on both servers:

Old Server (192.168.100.100):

sudo /var/ossec/bin/wazuh-control info
  • Wazuh Version: 4.3.6
  • Wazuh Revision: 40321
  • Wazuh Type: server

New Server (192.168.100.101):

sudo /var/ossec/bin/wazuh-control info
  • Wazuh Version: 4.12.0
  • Wazuh Revision: rc1
  • Wazuh Type: server

Planning the Data Migration Process

Data to Be Migrated

  1. Agent Configurations
    • client.keys file (agent keys)
    • Agent group configurations (/var/ossec/etc/shared/)
  2. Custom Security Rules
    • local_rules.xml (502 bytes)
    • local_decoder.xml (820 bytes)
  3. System Configurations
    • ossec.conf main configuration file (12,353 bytes)
    • lists/ folder (custom CDB lists)

Agent Information

A total of 6 agents were detected in the system:

  • ID: 001, Name: DB, IP: any
  • ID: 002, Name: APP, IP: any
  • ID: 003, Name: WEB, IP: any
  • ID: 004, Name: DC01, IP: any
  • ID: 005, Name: TEST, IP: any
  • ID: 006, Name: DB01, IP: any

Data Backup and Transfer Process

Step 1: Backup on the Old Server

bash

# Create the backup directory
mkdir -p ~/wazuh-backup-migration
cd ~/wazuh-backup-migration

# Back up critical files
sudo cp /var/ossec/etc/ossec.conf ./ossec.conf
sudo cp /var/ossec/etc/client.keys ./client.keys
sudo cp /var/ossec/etc/rules/local_rules.xml ./local_rules.xml
sudo cp /var/ossec/etc/decoders/local_decoder.xml ./local_decoder.xml
sudo cp -r /var/ossec/etc/shared/ ./shared/
sudo cp -r /var/ossec/etc/lists/ ./lists/

# Agent bilgilerini export etme
sudo /var/ossec/bin/manage_agents -l > ./agents_list.txt
sudo /var/ossec/bin/agent_control -l > ./agents_status.txt

Backup Results

The backup completed successfully and the following files were obtained:

total 52
-rw-r--r--  1 root root  4096 Jul 22 09:14 .
drwxr-xr-x 18 root root  4096 Jul 22 09:19 ..
-rw-------  1 root root   450 Jul 22 09:14 client.keys
-rw-r--r--  1 root root   411 Jul 22 09:14 agents_list.txt
-rw-r--r--  1 root root   450 Jul 22 09:14 agents_status.txt
-rw-r--r--  1 root root   820 Jul 22 09:14 local_decoder.xml
-rw-r--r--  1 root root   502 Jul 22 09:14 local_rules.xml
-rw-r--r-- 1 root root 12353 Jul 22 09:14 ossec.conf
drwxr-xr-x  6 root root  4096 Jul 22 09:14 shared

Step 2: Packaging and Transferring the Data

# Verileri tar ile paketleme
sudo tar -czf wazuh-backup-$(date +%Y%m%d).tar.gz wazuh-backup-migration/

# Transfer to the new server
scp wazuh-backup-*.tar.gz wazuh@192.168.100.101:/root/

Applying the Data on the New Server

Step 3: Stopping the Services

sudo systemctl stop wazuh-manager
sudo systemctl stop filebeat  
sudo systemctl stop wazuh-dashboard
sudo systemctl stop wazuh-indexer

Step 4: Transferring the Client Keys

This is a critical step so that the agents can be recognized on the new server:

# Restore the client.keys file from backup
sudo cp ~/wazuh-backup-migration/client.keys /var/ossec/etc/
sudo chown root:wazuh /var/ossec/etc/client.keys
sudo chmod 640 /var/ossec/etc/client.keys

Client.keys Contents

The transferred agent keys:

001 DB any c2b47d0ab5c254f760419dca5f237ec93009305c7f0c7a307ede4cdc2512
002 APP any 0aa76b0ec3942f0fcafd4b250776e01e3fe92ea458e12990ac49bf6cb3Ie6890
003 WEB any ca025a21dd10637639de86e6005de773b166ee17f39b7a0b76ce10a299e1bcc
004 DC01 any cac18fe7cf9d15b67b6c4bee74c4aca0ee9b212e947b567e0220ad41bcd9
005 TEST any d9de337911113a37c1cc427ad439f51efd3ea075d100a5681fdedf7b83eb4d08
006 DB01 any 8ee6ed92396c35d3f0fc625d5c2b19ae79a4d8e918703741168bcac3f328

Step 5: Transferring Custom Rules and Decoders

# Transfer local rules
sudo cp ~/wazuh-backup-migration/local_rules.xml /var/ossec/etc/rules/
sudo chown root:wazuh /var/ossec/etc/rules/local_rules.xml
sudo chmod 640 /var/ossec/etc/rules/local_rules.xml

# Transfer local decoders
sudo cp ~/wazuh-backup-migration/local_decoder.xml /var/ossec/etc/decoders/
sudo chown root:wazuh /var/ossec/etc/decoders/local_decoder.xml  
sudo chmod 640 /var/ossec/etc/decoders/local_decoder.xml

Step 6: Transferring the Agent Group Configurations

# Back up and transfer the shared folder
sudo mv /var/ossec/etc/shared /var/ossec/etc/shared.backup
sudo cp -r ~/wazuh-backup-migration/shared /var/ossec/etc/
sudo chown -R root:wazuh /var/ossec/etc/shared/
sudo chmod -R 660 /var/ossec/etc/shared/*
sudo chmod -R 770 /var/ossec/etc/shared/

Agent Group Configurations

The transferred agent groups:

  • default: General agent configurations
  • GENEL-MERKEZ: Custom configuration for headquarters systems
  • VERI-MERKEZI: Configuration for data center systems

Configuration Validation and Starting the Services

Configuration Check

sudo /var/ossec/bin/wazuh-control configcheck

Result: ✅ Successful – No configuration errors were detected.

Starting the Services

# Start services in order
sudo systemctl start wazuh-indexer
sleep 30
sudo systemctl start wazuh-manager  
sleep 15
sudo systemctl start filebeat
sleep 10
sudo systemctl start wazuh-dashboard

All services started successfully and began running in the Active state.

Agent Connection Problem and Its Solution

Identifying the Problem

As a result of the agent checks:

sudo /var/ossec/bin/agent_control -l

Result: All agents were in the "Never connected" state.

Root Cause: The agents were still trying to connect to the old server IP (192.168.100.100), but the new server was running at IP 192.168.100.101.

Solution: Changing the IP Address

As the most practical solution, it was decided to change the new server's IP address to the old server's IP:

# Netplan configuration
sudo nano /etc/netplan/00-installer-config.yaml

# IP change: 192.168.100.101 → 192.168.100.100
sudo netplan apply

Advantages:

  • ✅ No configuration changes are needed on any agent
  • ✅ Agents connect to the new server automatically
  • ✅ A seamless transition is achieved
  • ✅ No changes are needed in DNS records

Results and Success Metrics

Successfully Migrated Components

ComponentStatusDetailAgent Keys✅ SuccessfulAll keys of the 6 agentsCustom Rules✅ Successfullocal_rules.xml (502 bytes)Custom Decoders✅ Successfullocal_decoder.xml (820 bytes)Agent Groups✅ Successfuldefault, GENEL-MERKEZ, VERI-MERKEZI Main Configuration

System Status

New Server Services:

  • wazuh-manager: ✅ Active
  • wazuh-indexer: ✅ Active
  • wazuh-dashboard: ✅ Active
  • filebeat: ✅ Active

Agent Status:

  • A total of 6 agents are defined
  • Connections are expected after the IP change

Lessons Learned and Recommendations

Technical Takeaways

  1. Version Compatibility: The upgrade from Wazuh 4.3.6 to 4.12.0 went smoothly
  2. Importance of client.keys: Agents cannot connect without this file
  3. IP Change Strategy: Changing the server IP is more practical than changing the agent configurations
  4. Indexer Dependency: The old system's indexer must be running in order to migrate historical data

Recommendations for Future Projects

  1. Planned Migration: Make sure the indexer service is running before shutting down the old system
  2. Test Environment: Always rehearse in a test environment for critical systems
  3. Backup Strategy: Plan regular data backups, not just configuration backups
  4. Documentation: Document custom rules and configurations

Conclusion

The project of installing Wazuh on Ubuntu 24.04 and migrating the data was completed successfully. The agent keys, custom security rules and system configurations were transferred to the new system without interruption. Thanks to the IP address change strategy, the system cutover was achieved without making any configuration changes on the agents.

Within the scope of the project, all 6 agents, the customized security rules and three different agent groups were successfully preserved. Although historical log data could not be transferred, security monitoring activities can now continue uninterrupted on the new system.

This experience has revealed the critical points and best practices to watch for in Wazuh migration processes, providing valuable knowledge to guide similar projects in the future.

Kerim Koç

Systems and infrastructure engineer. I write about Linux, open source, high availability and security.