Installation guides

Installing Elasticsearch on RHEL

Step-by-Step Guide

  1. Update the Package Index
    Open a terminal and update the package index to ensure you have the latest information about available packages:
   sudo yum update -y
  1. Download and Install the Elasticsearch Public Signing Key
    Add the Elasticsearch public GPG key to your system:
   sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
  1. Create the Elasticsearch Repository
    Create a repository file for Elasticsearch:
sudo tee /etc/yum.repos.d/elasticsearch.repo <<EOF
[elasticsearch-7.x]
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
  1. Install Elasticsearch
    Install Elasticsearch using the yum package manager:
   sudo yum install elasticsearch -y
  1. Configure Elasticsearch
    Open the Elasticsearch configuration file for editing:
   sudo nano /etc/elasticsearch/elasticsearch.yml

Set the network.host to localhost to restrict external access:

   network.host: localhost

Save and close the file.

  1. Start and Enable Elasticsearch
    Start the Elasticsearch service:
   sudo systemctl start elasticsearch

Enable Elasticsearch to start on boot:

   sudo systemctl enable elasticsearch
  1. Verify Elasticsearch Installation
    Check the Elasticsearch service status to ensure it is running:
   sudo systemctl status elasticsearch

If Elasticsearch is running, you should see an active (running) status.

  1. Test Elasticsearch Installation
    Test the Elasticsearch installation by sending an HTTP request to the Elasticsearch server: curl -X GET "localhost:9200/" You should see a JSON response with information about your Elasticsearch cluster.
  2. Install Elasticsearch Plugins (Optional)
    Elasticsearch supports various plugins. To install a plugin, use the elasticsearch-plugin command. For example, to install the analysis-icu plugin: sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu Restart Elasticsearch to apply the changes: sudo systemctl restart elasticsearch
  3. Configure Elasticsearch Memory Settings (Optional)
    By default, Elasticsearch allocates 1GB of heap memory. To adjust the heap size, open the jvm.options file:
    bash sudo nano /etc/elasticsearch/jvm.options
    Modify the -Xms and -Xmx settings to allocate the desired amount of memory (e.g., 2GB):
    conf -Xms2g -Xmx2g
    Save and close the file. Restart Elasticsearch to apply the changes:
    bash sudo systemctl restart elasticsearch
Other Recent Posts