BestDivision Logo

A Step-By-Step Guide to Installing Elasticsearch on Ubuntu 22.04

BestDivision
BestDivision  @bestdivision
Created At - 2023-09-25
Last Updated - 2024-08-28

Table of Contents

  • Prerequisites
  • Step 1: Update Your System
  • Step 2: Install Java
  • Step 3: Add Elasticsearch APT Repository
  • Step 4: Update Your Package Index
  • Step 5: Install Elasticsearch
  • Step 6: Start Elasticsearch
  • Step 7: Verify the Installation
  • Conclusion

Prerequisites

Before we get started, make sure you have the following:

  • An Ubuntu 22.04 server or virtual machine.
  • SSH access to your server with sudo privileges.
  • Java Development Kit (JDK) 11 or later installed.

Step 1: Update Your System

Start by updating your system to ensure that you have the latest package information and security updates. Open your terminal and run the following commands:

This will make sure your system is up to date.

Step 2: Install Java

Elasticsearch requires Java to run. You can install OpenJDK 11 or any compatible version. Run the following command to install OpenJDK 11:

You can verify the Java installation by running:

Step 3: Add Elasticsearch APT Repository

To install Elasticsearch, we need to add the official Elasticsearch APT repository to our system. Use the following command to import the Elasticsearch GPG key:

Now, add the Elasticsearch APT repository to your system's sources list:

You can replace "7.x" with a specific version of Elasticsearch if needed.

Step 4: Update Your Package Index

After adding the Elasticsearch repository, update your package index to include the new repository:

Step 5: Install Elasticsearch

With the repository set up and the package index updated, you can now install Elasticsearch using the following command:

Step 6: Start Elasticsearch

Once the installation is complete, start the Elasticsearch service:

To ensure Elasticsearch starts automatically on system boot, run:

Step 7: Verify the Installation

To verify that Elasticsearch is running correctly, you can use curl to query the Elasticsearch server:

If everything is set up correctly, you should see a JSON response with information about your Elasticsearch instance.

Congratulations! You've successfully installed Elasticsearch on your Ubuntu 22.04 server. You can now configure Elasticsearch according to your specific needs and start using it for your search and analytics requirements.

Conclusion

Elasticsearch is a powerful tool for various applications, including log analysis, full-text search, and more. Installing it on Ubuntu 22.04 is a straightforward process, as outlined in this guide. However, remember that Elasticsearch configuration can be complex, depending on your use case. Be sure to consult the official Elasticsearch documentation for further information on configuration and usage.

Share

‌

  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌
  • ‌

    ‌
    ‌

    ‌

    ‌