Install Elasticsearch 6.x on Ubuntu 18.04 (Bionic Beaver)

ComputingPost
2 min readNov 16, 2022

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 - https://artifacts.elastic.co/GPG-KEY-elasticsearch | 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 https://artifacts.elastic.co/packages/oss-6.x/apt 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:

cluster.name: 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

Change:

-Xms2g

-Xmx2g

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

-Xms512m

-Xmx512m

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:

$ 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

Docs: http://www.elastic.co

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.

https://www.computingpost.com/install-elasticsearch-6-x-on-ubuntu-18-04-bionic-beaver/?feed_id=19050&_unique_id=63742a45a0f41

--

--

ComputingPost

ComputingPost — Linux Howtos, Tutorials, Guides, News, Tips and Tricks.