How to Install Elasticsearch 8 on Ubuntu 24.04

This article details the installation of Elasticsearch 8 on Ubuntu 24.04, a powerful open-source search and analytics engine. It outlines prerequisite package installation, GPG key addition, repository setup, and the installation process. After installing, it emphasizes configuring Elasticsearch, managing its services, and adjusting settings in the configuration file for optimal performance.

This article explains how to install Elasticsearch 8 on Ubuntu 24.04.

Elasticsearch is a robust, open-source search and analytics engine designed to handle large volumes of data in real time. Built on the Apache Lucene library, it offers a distributed, scalable, and high-performance platform for full-text search, structured search, and analytics.

It integrates seamlessly with other components in the Elastic Stack, such as Logstash and Kibana, enabling the creation of a comprehensive data processing and visualization ecosystem.

Installing Elasticsearch on Ubuntu lets you fully utilize its capabilities for search, analytics, logging, or any combination thereof.

Install prerequisites

Consider installing these packages before setting up Elasticsearch.

To install the required packages, please run the command below.

sudo apt update
sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl wget

Install Elasticsearch

Once Ubuntu is updated, run the command below to add the Elasticsearch GPG repository key.

wget -q https://artifacts.elastic.co/GPG-KEY-elasticsearch -O- | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg

Then add the repository file.

echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list

After that, update the Ubuntu packages index and install Elasticsearch.

sudo apt update
sudo apt install elasticsearch

When you install Elasticsearch, security features are enabled and configured by default. The passwords, certificates, and keys will be output to your terminal.

--------------------------- Security autoconfiguration information ------------------------------

Authentication and authorization are enabled.
TLS for the transport and HTTP layers is enabled and configured.

The generated password for the elastic built-in superuser is : e+x0VI*0wOpBVO9Z0ecz

You can complete the following actions at any time:

Reset the password of the elastic built-in superuser with
'/usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic'.

Configure Elasticsearch

With Elasticsearch installed, you can begin configuring it to work in your environment.

First, start up its services.

sudo systemctl enable elasticsearch.service --now

By default, Elasticsearch uses [/var/lib/elasticsearch] for storing data. This directory holds indexed data and manages the cluster’s state.

The main configuration files are located in [/etc/elasticsearch].

Run the command below to open its configuration file.

sudo nano /etc/elasticsearch/elasticsearch.yml

Then, start configuring the settings that work for you.

In the Network section, remove the comment from the relevant line for network binding and set it to your preferred IP address.

You can configure a cluster name, node identification, memory allocation, and other settings.

# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# Add custom attributes to the node:
# Enable security features. Change to false if SSL isn't configured.
xpack.security.enabled: false

Save the file and exit.

After making changes to the configuration file, restart Elasticsearch to apply those changes.

sudo systemctl restart elasticsearch

To test if Elasticsearch is running, run the command below.

curl http://localhost:9200

It should output something similar to the one below.

{
"name" : "node-1",
"cluster_name" : "my-application",
"cluster_uuid" : "aQCFrr5XQpiQ0AQnpQxn_A",
"version" : {
"number" : "8.17.3",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "a091390de485bd4b127884f7e565c0cad59b10d2",
"build_date" : "2025-02-28T10:07:26.089129809Z",
"build_snapshot" : false,
"lucene_version" : "9.12.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}

Or use the web browser.

That should do it!

Conclusion:

Installing Elasticsearch 8 on Ubuntu 24.04 provides a powerful solution for managing and searching large datasets. Here’s a recap of the key points:

  • Robust Search Solutions: Elasticsearch is designed for high-performance data retrieval and analytics.
  • Seamless Integration: Works well with other Elastic Stack components like Logstash and Kibana for a complete data processing environment.
  • Easy Installation: The installation process is straightforward and can be completed with a few commands.
  • Security Features: Comes with built-in security features, ensuring that your data is protected from unauthorized access.
  • Customizable Configuration: Offers flexibility in setting up configurations to meet specific use cases.

Following the steps outlined in this guide will enable you to leverage Elasticsearch in your projects.

Comments

Leave a Reply

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