Installation guides

Installing Elasticsearch on Debian

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 apt update
  1. Install Java
    Elasticsearch requires Java to run. Install OpenJDK, which is a free and open-source implementation of the Java Platform:
   sudo apt install openjdk-11-jdk

Verify the Java installation:

   java -version
  1. Download and Install the Elasticsearch Public Signing Key
    Add the Elasticsearch public GPG key to your system:
   wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
  1. Add the Elasticsearch Repository
    Add the Elasticsearch repository to your sources list:
   sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
  1. Update the Package Index Again
    Update the package index to include the Elasticsearch repository:
   sudo apt update
  1. Install Elasticsearch
    Install Elasticsearch using the apt package manager:
   sudo apt install elasticsearch
  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