In this tutorial, we will explain How to install Elasticsearch on Ubuntu. Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents. Elasticsearch is developed in Java. Following an open-core business model, parts of the software are licensed under various open source licenses (mostly the Apache License), while other parts fall under the commercial (source-available) Elastic License.

Prerequisites

You will need:

  • VPS running Ubuntu

Step 1 – Install OpenJDK

Elasticsearch is written in Java programming language so it’s needed to install. To install run this command:

sudo apt-get install openjdk-8-jre

Step 2 – Download Elasticsearch RPM

Now download the Elasticsearch GPG KEY file by running this command:

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

After, download the Elasticsearch deb file:

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

Step 3 – Install Elasticsearch

Now its time to install Elasticsearch. Install it by running rpm file:

sudo apt-get install elasticsearch

After you need to add your server IP to elasticsearch.yml :

nano /etc/elasticsearch/elasticsearch.yml

Change this line :

# network.host: 192.168.0.1

To:

network.host: 192.168.100.100

Note: Change 192.168.100.100 with your server IP address.

Now you need to enable Elasticsearch:

systemctl enable elasticsearch.service

And to start it:

systemctl start elasticsearch.service

Step 4 – Test Elasticsearch

Now you can test Elasticsearch by running this command:

curl -X GET 'http://localhost:9200">http://youripaddress:9200'

Conclusion

You have successfully installed Elasticsearch on Ubuntu.

Enjoy it.