Elasticsearch A Comprehensive Guide to Elasticsearch Installation

By Opster Team

Updated: Jul 23, 2023

| 2 min read

Introduction 

Elasticsearch, a highly scalable open-source full-text search and analytics engine, is a crucial component of many data-driven applications. This article will guide you through the process of installing Elasticsearch on different platforms, including Linux, Windows, and macOS. 

Installing Elasticsearch on Linux or MacOS

  1. Prerequisites: Ensure that you have Java 17 or later installed on your system. You can verify this by running `java -version` in your terminal. If you don’t have Java installed, there’s also a pre-configured bundled version in the Elasticsearch distribution.
  1. Download Elasticsearch: You can download Elasticsearch directly from the official Elastic website. Choose the appropriate version for your system and download the .tar.gz file.
  1. Extract the Files: Once the download is complete, extract the files using the command `tar -xzf elasticsearch-<version>.tar.gz`.
  1. Navigate to the Elasticsearch Directory: Use the command `cd elasticsearch-<version>/` to navigate to the Elasticsearch directory.
  1. Start Elasticsearch: Run `./bin/elasticsearch` to start Elasticsearch.

Installing Elasticsearch on Windows

  1. Prerequisites:  Ensure that you have Java 17 or later installed on your system. You can verify this by running `java -version` in your command prompt. If you don’t have Java installed, there’s also a pre-configured bundled version in the Elasticsearch distribution.
  1. Download Elasticsearch: You can download Elasticsearch directly from the official Elastic website. Choose the appropriate version for your system and download the .zip file.
  1. Extract the Files: Once the download is complete, extract the files using your preferred extraction tool.
  1. Navigate to the Elasticsearch Directory: Use the command `cd elasticsearch-<version>/` to navigate to the Elasticsearch directory.
  2. Start Elasticsearch: Run `.\bin\elasticsearch.bat` to start Elasticsearch.

Initial run

When starting Elasticsearch for the first time, security features are configured and enabled by default. The default password for the built-in elastic superuser is printed in the terminal window, as well as the enrollment token for Kibana. You will also find instructions for resetting the password and the Kibana enrollment token.

Verifying the Installation

Regardless of the platform, you can verify that Elasticsearch is running by sending a GET request to port 9200 on localhost. You can do this by navigating to `https://localhost:9200` in your web browser or by running the following command in your terminal window: 

curl --cacert $ES_HOME/config/certs/http_ca.crt -u elastic https://localhost:9200/

If Elasticsearch is running, you should receive a response with the version number and other details about your Elasticsearch instance.

Conclusion

Installing Elasticsearch is a straightforward process, regardless of your operating system. By following these steps, you can have Elasticsearch up and running on your system in no time. Remember to verify your installation to ensure that everything is working as expected.