Install Wazuh server Components

The Wazuh server in your lab will be running the Wazuh manager, Wazuh API, and Filebeat applications.

Log in and sudo to root

This is how it should look like, after loging in and gaining sudo privileges with sudo su:

[centos@wazuh-manager ~]$ sudo su -
[root@wazuh-manager ~]#

Add the Wazuh yum repository

The first step to setting up the manager is to add the Wazuh repository:

# cat > /etc/yum.repos.d/wazuh.repo <<\EOF
name=Wazuh repository

Install and set up Wazuh server

Install the Wazuh manager software and start its service:

# yum -y install wazuh-manager
# systemctl start wazuh-manager

Configure Wazuh manager to allow self registration of new agents with authentication:

# grep "<use_password>" -B7 -A8 /var/ossec/etc/ossec.conf
# sed -i 's/<use_password>no/<use_password>yes/' /var/ossec/etc/ossec.conf
# grep "<use_password>" -B7 -A8 /var/ossec/etc/ossec.conf
# echo "please123" > /var/ossec/etc/authd.pass # this is the password agents will use for self-registration

Restart Wazuh manager and confirm the agent listener and the self-registration listener are in place:

[root@wazuh-manager ~]# systemctl restart wazuh-manager
[root@wazuh-manager ~]# netstat -natp | egrep "(:1514|:1515)"
tcp        0      0  *               LISTEN      14311/ossec-remoted
tcp        0      0  *               LISTEN      14263/ossec-authd

New in version 4.0.0.

The Wazuh API will be installed along the Wazuh manager by default. No extra steps or requirements are needed to install it.


Check out the section Wazuh API for more information on how to set up and use the Wazuh API.

Install Filebeat

Filebeat is the tool on the Wazuh server that will securely forward the alerts and archived events to the Elasticsearch service.

  1. Install the GPG keys from Elastic, and the Elastic repository:

# rpm --import
# cat > /etc/yum.repos.d/elastic.repo << EOF
name=Elasticsearch repository for 7.x packages
  1. Install Filebeat:

# yum install filebeat-7.9.1
  1. Download the Filebeat configuration file from the Wazuh repository. This is pre-configured to forward Wazuh alerts to Elasticsearch:

# curl -so /etc/filebeat/filebeat.yml
# chmod go+r /etc/filebeat/filebeat.yml
  1. Download the alerts template for Elasticsearch:

# curl -so /etc/filebeat/wazuh-template.json
# chmod go+r /etc/filebeat/wazuh-template.json
  1. Download the Wazuh module for Filebeat:

# curl -s | sudo tar -xvz -C /usr/share/filebeat/module
  1. Edit and set the specific IP address of your Elasticsearch instance into the Filebeat config:

# sed -i 's/YOUR_ELASTIC_SERVER_IP/' /etc/filebeat/filebeat.yml
  1. Enable and start the Filebeat service:

# systemctl daemon-reload
# systemctl enable filebeat.service
# systemctl start filebeat.service
  1. Now disable the Wazuh and Elastic repositories in order to prevent unintended upgrades that may cause a version conflict with the current installation.

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