Elasticsearch is a full-text search engine that is used to manage the huge size of data in real-time by storing, searching, and analyzing all the data as it supports the REST(Representational State Transfer) API. The Elasticsearch collects the unorganized data and arranges it according to the user-defined functions in real-time. This is used as a complicated search engine similar to the Google search engine and mostly nowadays, it is being used for managing E-commerce online stores.
In this article, the installation method of Elasticsearch has been discussed in detail by using the command-line interface on Ubuntu.
How to Install Elasticsearch on Ubuntu 22.04
To install Elasticsearch on Ubuntu, first, import the GPG key and add the repository of Elasticsearch. We can do this simply by following the few steps which are:
Step 1: Import the GPG key of Elasticsearch on Ubuntu 22.04
To import the GPG key of Elasticsearch, open the terminal in Ubuntu and run the command:
To import the GPG key of Elasticsearch, open the terminal in Ubuntu and run the command: $ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Step 2: Add the repository of Elasticsearch on Ubuntu 22.04
To add the repository of Elasticsearch, use the command:
$ sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'
Step 3: Update the Ubuntu 22.04
After adding the repository of Elasticsearch, update all the packages of Ubuntu by executing the command:
$ sudo apt update
Step 4: Install the package Elasticsearch on Ubuntu 22.04
Finally, to install the package of Elasticsearch, execute the command:
$ sudo apt install elasticsearch -y
Step 5: Enable the service of Elasticsearch on Ubuntu 22.04
Unlike other services, Elasticsearch’s service is not enabled or activated by default after installation, so enable it manually using the command:
$ sudo systemctl enable --now elasticsearch.service
Step 6: Verification of the installation of Elasticsearch on Ubuntu 22.04
To verify the installation of Elasticsearch, we will send a request to any port using the curl command, for example, port 9200:
$ curl -X GET "localhost:9200/"
You will see the output similar to the shown in the figure below:
If we talk about the configuration, then there is no need to configure the Elasticsearch, you just have to install it, enable it, and you are good to enjoy the Elasticsearch service. But if you still want to find out its configuration settings, then you can visit the /etc/elasticsearch, and all data is stored in /var/lib/elasticsearch.
Elasticsearch is a good option if you are searching data from scattered data and arranging it according to your choice in real-time. In this write-up, the installation method of Elasticsearch on Ubuntu has been explored using some simple commands which can be run in the terminal of Ubuntu.