How to Install and Configure Elasticsearch on Ubuntu ?

Elasticsearch is a Cross-platform search engine based on Apache’s Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. It is written in Java.

Prerequisites: Java Installation on Ubuntu

Step 1: First, update your system by using the following command:

$sudo apt install update

Updating Ubuntu System

Step 2: Download .deb file for elasticsearch.



$wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/deb/elasticsearch/2.3.1/elasticsearch-2.3.1.deb

downloading deb file for elasticsearch

Step 3: Use dpkg commond to install the .deb file.

$sudo dpkg -i elasticsearch-2.3.1.deb

dpkg command to install .deb file

Step 4: Enable elasticsearch service

$sudo systemctl enable elasticsearch.service

Enable elasticsearch service

Step 5: Setup network configuration for elasticsearch. Open file

$sudo nano /etc/elasticsearch/elasticsearch.yml

and set IP as localhost

...
network.host: 127.0.0.1
...

Setup network configuration for elasticsearch

Step 6: Now, restart service.

$sudo systemctl restart elasticsearch

Step 7: Using and Testing Elasticsearch

$curl -X GET 'http://localhost:9200'

Output of curl

{
  "name" : "Node-1",
  "cluster_name" : "mycluster1",
  "version" : {
    "number" : "2.3.1",
    "build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
    "build_timestamp" : "2016-04-04T12:25:05Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  }
}

Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up

A Computer Science and Engineering undergraduate student at IERT, Allahabad with an interest in Programming, Data Science/AI and web development

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.