How to Install Elasticsearch on Ubuntu 20.04

Install Elasticsearch on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Elasticsearch on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Elasticsearch is a platform for distributed search and analysis of data in real-time. It is a popular choice due to its usability, powerful features, and scalability. With Elasticsearch, you can store, search, and analyze big volumes of data faster and in near real-time. Elasticsearch is generally used as the underlying engine/technology that powers applications that have complex search features and requirements.

Install Elasticsearch on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Java.

Elasticsearch is based on Java and requires Java to be installed. You can either install Oracle Java Standard Edition 8 or use the open-source version of Java called OpenJDK 8:

You can verify that we have Java installed by running this command:

Step 3. Install Elasticsearch on Ubuntu system.

Now we add Elasticsearch GPG key:

After importing its GPG key, run the commands below to add its package repository:

Once the repository is enabled, update the apt package list and install the Elasticsearch engine by typing:

After that installing Elasticsearch package, you can use the commands below to make sure it automatically starts up when the server boots up and start it:

Step 4. Configure Elasticsearch.

You can customize this by editing the Elasticsearch configuration file. Edit configuration file in your favourite text editor and update the following values:

Change the following values:

Restart the Elasticsearch service for the changes to take effect:

Step 5. Test Elasticsearch Setup.

You can verify that Elasticsearch is running by sending an HTTP request to port 9200 on localhost with the following curl command:

You should see something similar to this:

That’s all you need to do to install Elasticsearch on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.