How to Install Elasticsearch Engine on Ubuntu 16.04 / 18.04

Elasticsearch is an open source, Java-based search engine that provides a distributed, scalable and speedy search and analytics platform via an HTTP web interface, schema-free JSON-style documents and built on Apache Lucene library..

For businesses looking for solutions to search their complex and big data, including eCommerce database easily, Elasticsearch might be a good place to start..

This brief tutorial shows students and new users how to install Elasticsearch platform on Ubuntu 16.04 / 18.04 LTS servers..

For more about Elasticsearch, please check its homepage..When you’re ready to install Elasticsearch on Ubuntu, please follow the steps below:

Step 1: Install OpenJDK 8

Elasticsearch is based on Java and requires Java to be installed.. You can either install Oracle Java Standard Edition 8 or use the open source version of Java called OpenJDK 8…

For this tutorial, we’re going to be installing OpenJDK 8 on Ubuntu… To do that, run the commands below:

sudo apt update
sudo apt install openjdk-8-jdk

After that run the commands below to see if Java is successfully installed…

java -version

You should see similar message as shown below:

openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

When you see the above message, then OpenJDK 8 is installed successfully…

Step 2: Install Elasticsearch

Now that OpenJDK 8 is installed, run the commands below to add Elasticsearch GPG key by importing it…

wget -qO - | sudo apt-key add -

After importing its GPG key, run the commands below to  add its package repository to Ubuntu…

sudo sh -c 'echo "deb stable main" > /etc/apt/sources.list.d/elastic-6.x.list'

At the time of writing this post, Elasticsearch version 6.6.1 is the latest… If you prefer previous versions, you will have to update the repository package list to include previous packages…

Once the Elasticsearch repository is added and enabled, run the commands below to update apt package list and install Elasticsearch…

sudo apt update
sudo apt install elasticsearch

After installing Elasticsearch package, you can use the commands below to make sure it automatically starts up when the server boots up and start it immediately…

sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service

Elasticsearch should be installed and ready to use…

Our of the box, there’s no authentication and any one can access its portal via HTTP… It also only listen for traffic on the localhost via port # 9200

If you’re running a single host server and the client connecting from the same server, then no configuration is required… If the clients will be connecting from remote systems, then you’ll want to allow external clients…

To do that, open the elasticsearch.yml configuration file:

sudo nano /etc/elasticsearch/elasticsearch.yml

Then search for the line that contains, uncomment it, and change the highlighted value to

# ---------------------------------- Network -----------------------------------
# Set the bind address to a specific IP (IPv4 or IPv6):
# Set a custom port for HTTP:
#http.port: 9200
# For more information, consult the network module documentation.

Save the file and exit…

When you’re done, restart Elasticsearch

sudo systemctl restart elasticsearch.service

That should do it!

Now open your browser and browse to the server hostname or IP addressed followed by port #9200.. You should see the service respond with JSON data..


Elasticsearch ubuntu install

Congratulations! You have successfully installed Elasticsearch platform on Ubuntu 16.04 / 18.04 LTS servers…

You may also like the post below:

How to Install the Official Google Chrome Browser on Ubuntu 16.04 / 18.04

One Reply to “How to Install Elasticsearch Engine on Ubuntu 16.04 / 18.04”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.