Table of Contents
- 1. Install Java:
- 2. Import Elasticsearch GPG Key:
- 3. Add Elasticsearch Repository:
- 4. Install Elasticsearch:
- 5. Configure Elasticsearch:
- 6. Enable and Start Elasticsearch Service:
- 7. Test Elasticsearch:
- 8. Configure Firewall:
- 9. Install Kibana (Optional):
- 10. Install Logstash (Optional):
- 11. Secure Your Elasticsearch Cluster (Optional):
Installing and configuring Elasticsearch on Rocky Linux 9 involves a few steps. Here’s a guide to help you set it up:
1. Install Java:
Elasticsearch requires Java to run. Install OpenJDK:
sudo dnf install java-11-openjdk-devel
2. Import Elasticsearch GPG Key:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
3. Add Elasticsearch Repository:
Create a new repository file for Elasticsearch:
sudo tee /etc/yum.repos.d/elasticsearch.repo <<EOF [elasticsearch] name=Elasticsearch repository for 7.x packages baseurl=https://artifacts.elastic.co/packages/7.x/yum gpgcheck=1 gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch enabled=1 autorefresh=1 type=rpm-md EOF
4. Install Elasticsearch:
Install Elasticsearch using the following command:
sudo dnf install elasticsearch
5. Configure Elasticsearch:
Open the Elasticsearch configuration file:
sudo nano /etc/elasticsearch/elasticsearch.yml
Adjust the following settings:
- Set
network.host
tolocalhost
if Elasticsearch will run on the same machine. - Set
discovery.type
tosingle-node
.
Save and close the file.
6. Enable and Start Elasticsearch Service:
Enable the Elasticsearch service to start on boot:
sudo systemctl enable elasticsearch
Start the Elasticsearch service:
sudo systemctl start elasticsearch
7. Test Elasticsearch:
Check if Elasticsearch is running:
curl -X GET "localhost:9200/"
You should see a JSON response indicating that Elasticsearch is up and running.
8. Configure Firewall:
If you have a firewall enabled, open the necessary ports:
sudo firewall-cmd --add-port=9200/tcp --permanent sudo firewall-cmd --reload
9. Install Kibana (Optional):
Optionally, you can install Kibana for visualization and exploration:
sudo dnf install kibana
Configure Kibana in the kibana.yml
file and start the service:
sudo systemctl enable kibana sudo systemctl start kibana
10. Install Logstash (Optional):
Optionally, you can install Logstash for data processing:
sudo dnf install logstash
Configure Logstash and start the service:
sudo systemctl enable logstash sudo systemctl start logstash
11. Secure Your Elasticsearch Cluster (Optional):
For security, you may want to set up authentication and encryption. Refer to the Elasticsearch documentation for more information on security settings.
That’s it! You’ve installed and configured Elasticsearch on Rocky Linux 9. Adjust the configurations based on your specific needs and security requirements.