How to install Elasticsearch 7 on Ubuntu 22.04, 20.04, a platform for real-time data search and analysis with a rapid display and analytical capabilities.
Step-by-step: Install and Config Elasticsearch 7 on Ubuntu Linux
The Debian package (*.deb) for Elasticsearch on Ubuntu can be download with the apt command, and Elasticsearch can be installed on any Debian-based system such as Debian and Ubuntu. In this article, itsmeit use elasticsearch ubuntu 20.04.
Step 1. Install OpenJDK
In order for Elasticsearch to work, you need to install OpenJDK, if it is already available, skip this step.
sudo apt install openjdk-11-jdk -y
Step 2. Add Elasticsearch PGP key
Elasticsearch Ubuntu packages are registered with PGP key D88E42B4, you can view at https://pgp.mit.edu with authentication key:
4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4
Download and add the key with the command below:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
Next, add the Elasticsearch repository to the path:
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
Step 3. Installing from the APT repository
You may need to install the
apt-transport-https the package on Debian before continuing:
sudo apt-get install apt-transport-https
Step 4. install elasticsearch ubuntu 22.04 | 20.04 version 7.x
sudo apt-get update && sudo apt-get install elasticsearch -y
Next, open the file
elasticsearch.yml, and find the line
network.host delete the comment (# Uncomment) and change the default IP 192.168.0.1 to localhost as shown below.
sudo nano /etc/elasticsearch/elasticsearch.yml
Ctrl + X and select
Y to save the config and start elasticsearch.
sudo systemctl start elasticsearch.service
To enable Elasticsearch to start with the Ubuntu system run the command below
sudo systemctl enable elasticsearch.service
If you just change the config, it can be reloaded without restart
sudo systemctl daemon-reload
To check Elasticsearch active status
sudo systemctl status elasticsearch
Step 5. Test Elasticsearch ready to work on Ubuntu
In step 4 we configure
network.host to be localhost, so you can open a browser and run URL: http://localhost:9200 to test:
or use the command below
curl -X GET http://localhost:9200
Above are 5 steps to install Elasticsearch 7 on Ubuntu. Elasticsearch is quite heavy so if you run it on a VPS, the recommended configuration you can see here.