This guide will help you to install Elasticsearch 6.x on Ubuntu 18.04 LTS (Bionic Beaver) server. Elasticsearch is an open-source analytics and full-text search engine based on Lucene. It provides a distributed, multi-tenant capable architecture which enables you to store, search and analyze huge volumes of data faster from an HTTP web interface and schema-free JSON documents.

Follow the steps below to Install Elasticsearch 6.x on Ubuntu 18.04 LTS server.

Step 1: Import Elasticsearch GPG Key

The first step is to import Elasticsearch GPG Key which will trust elasticsearch packages downloaded from the upstream repository. Import the key by running the commands on your terminal.

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

Step 2: Add Elasticsearch 6.x APT repository

Now that the GPG key has been imported, add the apt repository by running:

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

Step 3: Install OpenJDK

Elasticsearch is dependent on Java, you’ll need OpenJDK Java runtime environment installed to be able to run elasticsearch on your system.

sudo apt update
sudo apt install apt-transport-https default-jdk default-jre

Step 4: Install Elasticsearch 6.x on Ubuntu 18.04

Now run apt-get update  then install elasticsearch package on your Ubuntu 18.04 server:

sudo apt update
sudo apt install elasticsearch-oss

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 the 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 vim /etc/elasticsearch/jvm.options



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


Note that it is recommended to set the min and max JVM heap size to the same value. Xms represents the initial size of total heap space and Xmx represents the maximum size of total heap space.

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 elasticsearch service 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-08-18 05:16:08 UTC; 7s 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

You now have a working Elasticsearch 6.x on Ubuntu 18.04 LTS (Bionic Beaver) server.

Video course content:

Other articles related to Elasticsearch are:

How to Install Elasticsearch 6 on CentOS 7 with Kibana Data Visualization tool

Manage Logs with Graylog server on Ubuntu 18.04

How To Install Graylog 3 with Elasticsearch 6.x on CentOS 7

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here