Table of Contents
This practical guide explains how to install elasticsearch on ubuntu with clear steps and useful context. It also covers common requirements, potential problems, and the details that can help you get better results.
Prerequisites for Installing Elasticsearch

There is an important prerequisite for installing Elasticsearch on Ubuntu. Since Elasticsearch is a Java application, you will need to properly install and configure JDK version 11 or later on your system.
Here is how to check if JDK is installed on Linux:
java --version
This command will output the version of Java installed on your system. In case you get "command not found" message or any other kind of error, it probably means you don't have Java installed.
You can manually install the JDK by downloading the tarball or install it through the Linux distribution's package manager. Ideally install via the package manager, as it's faster and not as much hassle as the previous method.
This is how you can install JDK on Ubuntu using APT package manager:
sudo apt install openjdk-18-jdk
You can replace 18 in the command with any JDK version higher than 11. Wait for the installation to finish and then run the command again to check the Java version. This time around you will see the version as output.
How to Install Elasticsearch on Ubuntu
Step 1: Add the GPG Key and Update the Repository
Elasticsearch is not part of the official Ubuntu repositories. To install Elasticsearch using APT, you need to add its source list and GPG key.
Run the following commands to add the Elasticsearch package source and GPG key, and update the source list for APT:
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list sudo apt update
Note : You can change the "8" in the second command to "7" or some other version in case you want to download a specific version of Elasticsearch.
Step 2: Install Elasticsearch with APT

Now you can install the Elasticsearch package with APT like you would install any regular package. Here is the command to install Elasticsearch on Ubuntu:
sudo apt install elasticsearch
Enter Y when prompted for permission and wait for the installation to finish. Once installed, follow the steps that appear on the screen to configure Elasticsearch to integrate with Kibana or other data visualization software.
Step 3: Install Elasticsearch Using DEB. Package
In case you don't want to use APT to install Elasticsearch, you have the option to download the DEB package provided on the official website and install it using the dpkg command.
First, download the DEB package using wget. Then use the dpkg command with admin rights to install Elasticsearch:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.8.2-amd64.deb sudo dpkg -i elasticsearch-8.8.2-amd64.deb
Keep in mind that you may need to modify the command to match the version of Elasticsearch you want to install.
Conclusion
Understanding Ubuntu makes it easier to compare options, avoid common mistakes, and apply the information in this guide more effectively. Review the relevant requirements before making changes or choosing a solution.
FAQ
How do you install elasticsearch on ubuntu?
Follow the steps in this guide in order, confirm the required settings or tools, and verify the result before making additional changes.
Is it safe to install elasticsearch on ubuntu?
It is generally safe when you follow the recommended instructions, use trusted tools, and avoid changing settings you do not understand.
What should you do if the process does not work?
Recheck the requirements, restart the device or application when appropriate, and review each step for missed settings or compatibility issues.
Reader Comments 0
Sign in with email or Google to join the discussion.