How can I install Elasticsearch 7,6 or 5 on Ubuntu 19.04/18.04/16.04?. This guide will help you to install Elasticsearch 7/6/5 on Ubuntu 19.04/18.04/16.04. Elasticsearch is an Open Source full-text search and analytics engine tool used to store, search, and analyze big volumes of data in near real time.
The Debian package for Elasticsearch can be downloaded from the website or from our APT repository. In this guide, we will use the APT installation method, which installs Elasticsearch on any Debian-based system such as Debian and Ubuntu.
We will install the free version which is released under the Elastic license. See the Subscriptions page for information about Elastic license levels.
Step 1: Update your system
I like starting all installations on an updated system.
sudo apt update sudo apt -y upgrade
Step 2: Import the Elasticsearch PGP Key
Import Elasticsearch Signing Key used to sign all Elastic packages. Run the following command to download and install the public signing key:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Step 3: Add APT repository
Next, we add the Elasticsearch APT repository from where we will download and install the packages.
For Elasticsearch 7.x (Latest):
sudo apt -y install apt-transport-https echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
For Elasticsearch 6.x:
sudo apt -y install apt-transport-https echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-6.x.list
For Elasticsearch 5.x:
sudo apt -y install apt-transport-https echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-5.x.list
Step 4: Install Elasticsearch on Ubuntu 19.04/18.04/16.04
Then install the Elasticsearch Debian package by running:
sudo apt update sudo apt -y install elasticsearch
After the installation, a default configuration file will be populated to /etc/elasticsearch/elasticsearch.yml. Most 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:
Note that the default minimum memory set for JVM is 2gb, if your server has small memory size, change this value:
sudo nano /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 enable elasticsearch.service && sudo systemctl restart elasticsearch.service
Check elasticsearch service status:
$ systemctl status elasticsearch.service ● elasticsearch.service - Elasticsearch Loaded: loaded (/lib/systemd/system/elasticsearch.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2019-05-03 09:18:39 PDT; 18s ago Docs: http://www.elastic.co Main PID: 21459 (java) Tasks: 18 (limit: 1093) Memory: 429.0M CGroup: /system.slice/elasticsearch.service ├─21459 /usr/share/elasticsearch/jdk/bin/java -Xms512m -Xms512m -XX:+UseConcMarkSweepGC -XX:CMSIn └─21589 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller May 03 09:18:39 ubuntu systemd: Started Elasticsearch.
You have deployed a single node Elasticsearch cluster on your Ubuntu system.