How to Install Elasticsearch on Ubuntu 18.04 Bionic Beaver

Install Elasticsearch on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Elasticsearch on Ubuntu 18.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 flexible and powerful open source, distributed real-time search and analytics engine. 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

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

sudo apt update
sudo apt upgrade

Step 2. Install Java.

Java is the primary requirement for running Elasticsearch on any system. Make sure your system has Java installed by running following command:

sudo apt install openjdk-8-jdk

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

$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b14-2ubuntu0.18.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.191-b14, mixed mode)

Step 3. Install Elasticsearch on Ubuntu 18.04.

Use Elasticsearch official apt repository to install Elasticsearch on Ubuntu Linux system:

wget -qO - | sudo apt-key add -

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

sudo apt update
sudo apt install elasticsearch

Elasticsearch service will not start automatically after the installation process is complete. To start the service and enable the service run:

sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service

Step 4. Configure Elasticsearch.

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

sudo nano /etc/elasticsearch/elasticsearch.yml

Change the following values: ES_Cluster_01 "Cluster_01_Node_001"

Restart the Elasticsearch service for the changes to take effect:

sudo systemctl restart elasticsearch

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:

curl -X GET "localhost:9200/"

You should see something similar to this:

  "name" : "kwEpA2Q",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "B-5B34LramonaD3ww",
  "version" : {
    "number" : "6.6.1",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "1fd8f69",
    "build_date" : "2019-04-13T17:10:46.160291Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  "tagline" : "You Know, for Search"

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