Elasticsearch 7.17.x on Ubuntu 22.04+

This article provides a comprehensive guide for installing Elasticsearch version 7.17.x on an Ubuntu 22.04 system. It includes prerequisites, installation steps, configuration, and performance optimization guidelines recommended by OvalEdge.

Prerequisites

Before proceeding, ensure the following requirements are met:

  • Operating System: Ubuntu 22.04 LTS or later

  • User Access: Root or a user with sudo privileges

  • Network: Stable internet connection

  • Java: Java 17 installed (openjdk-17-jdk)

  • Firewall: Ensure required ports are open (9200, 9300)

Installation Steps

  1. Java Installation

    • Log in to the Elasticsearch VM and install Java 17:

      sudo apt update -y
      sudo apt install -y openjdk-17-jdk
      java --version

      Sample Reference Screenshot

  2. Elasticsearch Installation

    • Update Package Index and Enable HTTPS Support

      • Before installing Elasticsearch, update the package index and ensure secure APT transport is enabled:

        sudo apt update -y
        sudo apt install apt-transport-https -y

    • Create Elasticsearch Repository File

      Download and add the GPG key, then configure the repository:

      wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
      sudo sh -c 'echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" > /etc/apt/sources.list.d/elastic-7.x.list'

    • Install Elasticsearch

      Run the following commands to install Elasticsearch:

      sudo apt update
      sudo apt install elasticsearch -y

    • Enable and Start the Service

      Enable Elasticsearch to start at boot and then start the service:

      sudo systemctl daemon-reexec
      sudo systemctl enable elasticsearch
      sudo systemctl start elasticsearch

  3. Elasticsearch Configuration

    • Configure Elasticsearch Settings

      Open the Elasticsearch configuration file:

      sudo vi /etc/elasticsearch/elasticsearch.yml

      Add or update the following parameters:

      cluster.name: ovaledge
      network.host: 0.0.0.0
      http.port: 9200
      transport.host: localhost
      transport.tcp.port: 9300
      xpack.security.enabled: true

    • Configure JVM Heap Size

      Edit the JVM options file:

      sudo vi /etc/elasticsearch/jvm.options

      Locate the following lines (usually near the top of the file):

      ## -Xms4g
      ## -Xmx4g

      Uncomment and configure them:

      -Xms4g
      -Xmx4g

      Both values must be set to the same. Recommended value = 50% of available memory.

    • Restart Elasticsearch

      Restart the service to apply changes:

      sudo systemctl restart elasticsearch
  4. Elasticsearch Passwords

    • Set Password for Elastic User

      Run the password reset tool:

      sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i

      When prompted:

      • Type y and enter a new password for the elastic user

      • Confirm the password if requested

  5. Verify Installation

    • Verify Service Availability

      • Use curl or a browser to verify Elasticsearch is running:

        curl http://localhost:9200 -u elastic:<password>
      • Replace <password> with the password set previously

      • A successful response should display cluster information in JSON format

  6. Integrate Elasticsearch with OvalEdge

    • Locate and Edit oasis.properties

      On the OvalEdge application VM, navigate to the extprop directory and open the file:

      vi /path/to/ovaledge/extprop/oasis.properties

    • Update Elasticsearch Section

      Configure the following parameters:

      es.host=<elasticsearch_host>
      es.port=9200
      es.protocol=http
      es.username=elastic
      es.password=<password>

    • Restart Tomcat Service

      • Restart Tomcat to apply the updated configuration:

        sudo systemctl restart tomcat

Copyright © 2025, OvalEdge LLC, Peachtree Corners, GA, USA.

Last updated

Was this helpful?