Elasticsearch is a flexible and powerful open-source, distributed real-time search and analytics engine. Using a simple set of APIs, it provides the ability for full-text search. Elastic search is freely available under the Apache 2 license, which provides the most flexibility.

Advertisement

This tutorial will help you to install Elasticsearch on Debian 10, Debian 9 and Debian 8 systems.

Step 1 – Prerequsities

Login to your Debian system using sudo privileged user or root account.

Java is the primary requirement for running Elasticsearch on any system. Execute following commands to install Java on your Debian system.

sudo apt update
sudo apt install default-jdk

Then check the installed Java version.

java -version

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Debian-1deb10u1, mixed mode, sharing)

Also, make sure your JAVA_HOME environment variable is configured:

echo $JAVA_HOME

/usr/lib/jvm/java-11-oracle

Step 2 – Install Elasticsearch on Debian

Use Elasticsearch official apt repository to install Elasticsearch on Debian Linux system. Execute the following commands to import GPG key for Elasticsearch packages.

sudo apt-get install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Then configure the apt repository on your Debian system. The below command will add a repository to install latest Elasticsearch 6.X on your Ubuntu system.

add-apt-repository "deb https://artifacts.elastic.co/packages/7.x/apt stable main"

After adding the repository to your system. Run the following commands to update cache and then install Elasticsearch packages on your system.

sudo apt-get update
sudo apt-get install elasticsearch

Step 3 – Configure Elasticsearch on Debian

You can customize this by editing the Elasticsearch configuration file. Edit configuration file in your favorite text editor and update the following values:

sudo nano /etc/elasticsearch/elasticsearch.yml

Change the following values:

/etc/elasticsearch/elasticsearch.yml
 network.host: 0.0.0.0
 cluster.name: myCluster1
 node.name: "myNode1"
  • network.host – Set the network host to 0.0.0.0 to listen on all interfaces and make it publically available. You can use your LAN address for LAN access only.
  • cluster.name – Name of the cluster. For the multi-node cluster, all the nodes must use the same cluster name.
  • node.name – Set the unique name of the node to identify in a cluster.

Step 4 – Manage Elasticsearch Service

To configure Elasticsearch to start automatically when the system boots up, run the following commands:

sudo /bin/systemctl enable elasticsearch.service

Elasticsearch can be started and stopped as follows:

sudo systemctl start elasticsearch.service
sudo systemctl stop elasticsearch.service

Step 5 – Test Elasticsearch Setup

The Elasticsearch service is ready to use. You can test it using curl command-line utility. Run the simple GET command using curl to verify the setup. You will see the Elasticsearch cluster details with the version on your screen.

curl -X GET "http://localhost:9200/?pretty"
Console Output
{
  "name" : "myNode1",
  "cluster_name" : "myCluster1",
  "cluster_uuid" : "WwtS-lsSTIGmBYFo6POxlw",
  "version" : {
    "number" : "7.3.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "de777fa",
    "build_date" : "2019-07-24T18:30:11.767338Z",
    "build_snapshot" : false,
    "lucene_version" : "8.1.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
Share.

1 Comment

  1. Hi
    I follow your scheme above, however I do not obtain
    echo $JAVA_HOME
    /usr/lib/jvm/java-11-oracle,
    but my result on your installation is
    /usr/lib/jvm/java-11-openjdk-amd64.

Leave A Reply


Exit mobile version