You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

Elasticsearch is a highly scalable open-source analytics engine and full-text search. 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. This guide will show you how to install Elasticsearch 5.x on Ubuntu 18.04 LTS (Bionic Beaver) Linux.

For Elasticsearch 6.x, check How to Install Elasticsearch 6.x on Ubuntu 18.04 LTS (Bionic Beaver) Linux

Here is the guide to install Elasticsearch 5.x on Ubuntu 18.04 LTS.

Step 1: Import Elasticsearch GPG Key

The first step is to import Elasticsearch GPG Key using the command:

sudo apt update
wget -qO - | sudo apt-key add -

Step 2: Add Elasticsearch 5.x APT repository

Once the GPG key has been imported, add the apt repository so that you can install Elasticsearch package from:

sudo apt -y install apt-transport-https
echo "deb stable main" | sudo tee  /etc/apt/sources.list.d/elastic-5.x.list

Step 3: Install OpenJDK

Elasticsearch is dependent on Java, you need to install OpenJDK before you can continue.

sudo apt -y install default-jdk default-jre

Step 4: Install Elasticsearch 5.x on Ubuntu 18.04

Now run apt-get update  then install elasticsearch package:

sudo apt update
sudo apt install elasticsearch

After the installation, a default configuration file will be populated to /etc/elasticsearch/elasticsearch.ymlMost lines are commented out, edit the file to tweak and tune the configuration.

E.g, you can set correct cluster name for your applications: my-application

Note that the default minimum memory set for JVM is 2gb, if your server has small memory size, change this value:

$ sudo vi /etc/elasticsearch/jvm.options



And set your values for minimum and maximum memory allocation. E.g to set values to 512mb of ram, use:


After you have modified the configuration, you can start Elasticsearch:

sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl restart elasticsearch.service

Check status:

$ sudo systemctl status elasticsearch.service 
● elasticsearch.service - Elasticsearch
Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)
Active: active (running) since Sun 2018-07-01 10:39:54 UTC; 18s ago
Process: 14314 ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec (code=exited, status=0/SUCCESS)
Main PID: 14325 (java)
Tasks: 38 (limit: 2362)
CGroup: /system.slice/elasticsearch.service
└─14325 /usr/bin/java -Xms512m -Xmx512m -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -X

That’s all for the installation of Elasticsearch 5.x on Ubuntu 18.04 LTS (Bionic Beaver) Linux.

Video course content:

in stock
in stock

For Cluster setup, check out Setup Elasticsearch Cluster on CentOS / Ubuntu With Ansible

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF