How to Install Elasticsearch on Ubuntu Linux

|

|

This tutorial guides students and novice users through the process of installing and configuring Elasticsearch, a Java-based, open-source search engine built on the Apache Lucene library, on Ubuntu 20.04 or 18.04. The article provides a step-by-step process, including installing OpenJDK 8, and adding and enabling the Elasticsearch repository. It concludes by detailing how to permit…

This brief tutorial shows students and new users how to install and configure Elasticsearch on Ubuntu 20.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 and schema-free JSON-style documents. It is built on the Apache Lucene library.

There are many reasons to install Elasticsearch on Ubuntu Linux. Elasticsearch is a powerful and scalable search engine that can provide fast and efficient search capabilities for complex and big data, including eCommerce databases.

It’s open-source and built on the Apache Lucene library, making it an excellent choice for businesses looking for solutions to search their data easily. Additionally, Ubuntu is a popular Linux distribution widely used in many industries, making it a natural fit for Elasticsearch.

Installing Elasticsearch on Ubuntu is also relatively easy, and this brief tutorial provides step-by-step instructions to help you get started.

For more about Elasticsearch, please check its homepage.

When you’re ready to install Elasticsearch on Ubuntu, please follow the steps below:

Install OpenJDK 8

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

For this tutorial, we will install 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 a 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.

Install Elasticsearch

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

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | 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 https://artifacts.elastic.co/packages/6.x/apt stable main" > /etc/apt/sources.list.d/elastic-6.x.list'

When writing this post, Elasticsearch version 6.6.1 is the latest. If you prefer previous versions, you must update the repository package list to include previous ones.

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

sudo apt update
sudo apt install elasticsearch

After installing the Elasticsearch package, you can use the commands below to ensure it automatically starts when the server boots up and starts immediately.

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

Elasticsearch should be installed and ready to use.

Out of the box, there’s no authentication; anyone can access its portal via HTTP. It also only listens for traffic on the local via port # 9200

No configuration is required if running a single host server, and the client connects from the same server. If the clients are 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 network.host, uncomment it, and change the highlighted value to 0.0.0.0

# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0    
#
# 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 Elasticsearchhttps://geekrewind.com/how-to-install-the-office-google-chrome-on-ubuntu-16-04-18-04/

sudo systemctl restart elasticsearch.service

That should do it!

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

http://localhost:9200

Congratulations! You have successfully installed the Elasticsearch platform on Ubuntu 16.04 | 18.04 LTS servers.

You may also like the post below:


Discover more from Geek Rewind

Subscribe to get the latest posts to your email.

Like this:



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.

Blog at WordPress.com.