Welcome to today’s guide on how to install the latest Elasticsearch 7 on Debian 11/10/9. 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 11/10/9
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
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/elastic.gpg
Step 3: Add Elasticsearch APT repository
Next, we add the Elasticsearch APT repository from where we will download and install the packages.
For Elasticsearch 7.x:
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
Step 4: Install Elasticsearch 7 package
Then install the Elasticsearch on Debian package by running the commands below:
sudo apt update
sudo apt 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:
cluster.name: mycluster
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
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.
Step 5: Start Elasticsearch Service
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 Tue 2022-10-18 19:27:16 UTC; 9s ago Docs: https://www.elastic.co Main PID: 2290 (java) Tasks: 48 (limit: 4556) Memory: 1.1G CPU: 15.942s CGroup: /system.slice/elasticsearch.service └─2290 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless=true> Oct 18 19:27:05 debian11 systemd[1]: Starting Elasticsearch... Oct 18 19:27:16 debian11 systemd[1]: Started Elasticsearch.
You have successfully installed Elasticsearch 7.x on Debian 11/10/9 Linux. You next reading should be official Elasticsearch Documentation, to learn about real-world usage in your projects.
Learning book: Books To Learn ElasticSearch and Kibana
Similar guides:
- How to Install Elasticsearch on Ubuntu
- How to Install Elasticsearch on RHEL / CentOS 8
- How to delete Elasticsearch Index data with curl