To install Elasticsearch on AlmaLinux 9, follow these steps:
Step 1 : Update the System
Run the following command to update your system packages:

Step 2 : Install Java
Elasticsearch requires Java. Install it using:

Step 3 : Verify Java Installation
Check the installed Java version:

Step 4 : Import the Elasticsearch PGP Key
Add the Elasticsearch GPG key to your system:

Step 5 : Create the Elasticsearch Repository
Create a repository file for Elasticsearch:

Step 6 : Install Elasticsearch
Now install Elasticsearch using:

Step 7 : Start Elasticsearch
Start the Elasticsearch service:

Step 8 : Enable Elasticsearch to Start on Boot
Enable it to start automatically on boot:

Step 9 : Enable Security in Elasticsearch
Edit the Elasticsearch configuration file:
Find the line:
Change it to:

Step 10 : Restart Elasticsearch
Apply the changes by restarting Elasticsearch:

Step 11 : Check Elasticsearch Status
Verify that Elasticsearch is running:

Step 12 : Reset Elasticsearch Password
Run the following command to reset the elastic user password:

Save the generated password for later use.
Step 13 : Verify Installation
Test Elasticsearch using curl:

Replace yourpassword with the actual password you received in the previous step.
Congratulations! You have successfully installed and configured Elasticsearch on AlmaLinux 9.