Welcome to today’s guide on how to install the latest Elasticsearch 7 on Debian 10 (Buster) and Debian 9 (Stretch). Elasticsearch is a powerful open-source full-text search and analytics engine tool used to store, search, and analyze big volumes of data in near real-time.
The packages available on Debian upstream repositories doesn’t guarantee the most recent releases. For this reason, we’ll add Elasticsearch repository to our Debian machine before pulling the latest release of Elasticsearch 7.x.
For multi-node cluster, refer to Setup Elasticsearch Cluster on CentOS | Ubuntu With Ansible
Install Elasticsearch 7 on Debian 10/9 Linux
We will install the free version which is released under the Elastic license. See the Subscriptions page for information about Elastic license levels. Let’s begin by adding the repository URL to the system.
Step 1: Update your system
Let’s update our packages index:
sudo apt update
Step 2: Import the Elasticsearch PGP Key
Start by importing Elasticsearch Signing Key that is used to verify Elastic packages.
sudo apt -y install gnupg2 wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Step 3: Add Elasticsearch APT repository to Debian 10/9
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/oss-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/oss-6.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
Step 4: Install Elasticsearch on Debian 10 / Debian 9
Then install the Elasticsearch on Debian 10/9 package by running the commands below:
sudo apt update sudo apt -y install elasticsearch-oss
After the installation, a default configuration file will be populated to /etc/elasticsearch/elasticsearch.yml. Modify this file to your liking.
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.
Step 5: Start Elasticsearch Service on Debian 10 / Debian 9
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 Mon 2019-08-05 07:32:32 CEST; 13s ago Docs: http://www.elastic.co Main PID: 2902 (java) Tasks: 51 (limit: 4915) Memory: 1.2G CGroup: /system.slice/elasticsearch.service ├─2902 /usr/share/elasticsearch/jdk/bin/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInit └─2990 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller Aug 05 07:32:32 debian10 systemd: Started Elasticsearch. Aug 05 07:32:33 debian10 elasticsearch: OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will li ......
You have successfully installed Elasticsearch 7.x on Debian 10/9 Linux. You next reading should be official Elasticsearch Documentation, to learn about real-world usage in your projects.
How to Install Elasticsearch 7,6,5 on Ubuntu
How to Install Elasticsearch on RHEL / CentOS 8