Elasticsearch is an open-source, freely available, distributed analytical engine for geographic, numerical, textual, structured, and unstructured data. It was released in 2010 by Elasticsearch N.V and is based on Apache Lucene. The foundation of the Elastic Stack is Elasticsearch is, which is a collection of open-source technologies for visualization, analysis, data storage and its ingestion. It is also known for its easy Representational State Transfer (REST) APIs, speed, scalability, and distributed nature. Beats are a collection of lightweight shipping agents currently available in the Elastic Stack. The data is transferred to Elasticsearch using these beats.

Elasticsearch collects unstructured data from many sources, organizes it according to user-defined mapping, and indexes it in real-time. It is a well-known search engine designed for applications with sophisticated search requirements. You can use Elasticsearch for creating a complicated search engine that works similar to the Google search engine.

The scalability and speed of Elasticsearch, as well as its ability to index a wide range of content types, makes it suitable for various purposes, including Website search, Application search, Enterprise search, monitoring performance of an application, Business analytic, Security analytic, log and logging analytic, analysis and visualization of Geo-spatial data.

Why use Elasticsearch on Ubuntu

Some of the significant reasons are mentioned below:

  • Elasticsearch has a variety of features that helps it to handle different content types.
  • By its nature, Elasticsearch is distributed.
  • Elasticsearch is ideal for time-sensitive use cases like Security analytic and infrastructure monitoring.
  • Data ingest, visualization, and reporting are all made easier using Elasticsearch.

How to install Elasticsearch on Ubuntu

If you want to install Elastic search on your Ubuntu system, then firstly, open up your terminal by pressing “CTRL ALT T”, you can also open the terminal by searching it in the Application’s search bar:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-1.png" data-lazy- height="375" src="data:image/svg xml,” width=”678″>

Before starting the installation process, we will update our system repositories:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-2.png" data-lazy- height="439" src="data:image/svg xml,” width=”727″>

Now, we will install the dependencies to our system that are essential for adding an HTTP repository:

$ sudo apt install apt-transport-https ca-certificates wget

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-3.png" data-lazy- height="474" src="data:image/svg xml,” width=”827″>

Enter “y/Y” to permit the installation process to continue:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-4.png" data-lazy- height="608" src="data:image/svg xml,” width=”792″>

Now, it’s time to import the GPG’s key of the Elasticsearch repository:

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

The successful execution of the above-given command will print out “OK” on the terminal screen:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-5.png" data-lazy- height="287" src="data:image/svg xml,” width=”756″>

After importing the GPG’s key, we will add the Elasticsearch repository by executing this 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’

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-6.png" data-lazy- height="268" src="data:image/svg xml,” width=”731″>

As the repository is added to Ubuntu system, now execute this command in the terminal:

Your system repositories will be updates in few seconds:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-7.png" data-lazy- height="441" src="data:image/svg xml,” width=”729″>

Write out the below-given command for installing Elasticsearch on your system:

$ sudo apt install elasticsearch

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-8.png" data-lazy- height="480" src="data:image/svg xml,” width=”730″>

Next, start the service of the installed engine by executing this command:

$ sudo systemctl start elasticsearch

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-9.png" data-lazy- height="263" src="data:image/svg xml,” width=”792″>

You can confirm if Elasticsearch is successfully running on your system by using the curl command. For this purpose, write out the curl command for submitting an HTTP request to your system’s port 9200:

$ curl -X GET “localhost:9200/”

The execution of the above-given command will show you the following output:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-10.png" data-lazy- height="472" src="data:image/svg xml,” width=”792″>

Elasticsearch does not integrate authentication. Therefore, anyone who can access the HTTP API and use it. You will need to open TCP port 6379, as a client will utilize this port for creating a TCP connection to the Redis server. You can also add your IP address or IP range for accepting connection from them only. For instance, the below-given command permits the connections from “192.168.121.0/24” IP address of the other system:

$ sudo ufw allow proto tcp from 192.168.121.0/24 to any port 6379

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-11.png" data-lazy- height="309" src="data:image/svg xml,” width=”839″>

How to configure Elasticsearch on Ubuntu

We have successfully configured the firewall; now, we will move towards the configuration of the Elasticsearch on Ubuntu. For this, open up the Elasticsearch configuration file in your “nano” editor:

$ sudo nano /etc/elasticsearch/elasticsearch.yml

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-12.png" data-lazy- height="281" src="data:image/svg xml,” width=”727″>

Look for the line that contains the “network host” and uncomment it:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-13.png" data-lazy- height="474" src="data:image/svg xml,” width=”728″>

Change the network host value to “0.0.0.0” to listen to the external connections:

Here, “0.0.0.0” signifies the default route of your network host:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-14.png" data-lazy- height="476" src="data:image/svg xml,” width=”728″>

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-15.png" data-lazy- height="480" src="data:image/svg xml,” width=”731″>

The last step is to restart the Elasticsearch service:

$ sudo systemctl restart elasticsearch

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2021/09/echo/How-to-install-Elasticsearch-on-Ubuntu-16.png" data-lazy- height="240" src="data:image/svg xml,” width=”731″>

All done! Now you are all ready to connect with the Elasticsearch server from your remote location.

Conclusion

Elasticsearch is a platform for real-time distributed data search and analysis. Because of its usability, robust capabilities, and scalability, it is a popular search engine. It is also capable of massively aggregating and monitoring Big Data. In this article, we demonstrated how to install and configure Elasticsearch on Ubuntu. Now feel free to try Elasticsearch on your system!