Elasticsearch is a powerful open-source analytics and search engine. It allows you to store, search, and analyze large volumes of data quickly and in near real-time. In this guide, we will go through the steps to install Elasticsearch 7 on Ubuntu 22.04/20.04, enabling you to leverage it for your projects, such as Magento 2.
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
![Install OpenJDK](https://arriveddev.com/wp-content/uploads/2022/03/how-to-install-elasticsearch-7-x-on-ubuntu-1.jpg)
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: /etc/apt/sources.list.d/elastic-7.x.list
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
![Add Elasticsearch PGP key](https://arriveddev.com/wp-content/uploads/2022/03/how-to-install-elasticsearch-7-x-on-ubuntu.jpg)
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
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
![Config Elasticsearch 7.x on Ubuntu 20.04, 22.04](https://arriveddev.com/wp-content/uploads/2022/04/how-to-install-elasticsearch-7-x-on-ubuntu-20.04-22.04-3.jpg)
Press 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:
![install Elasticsearch on Ubuntu 22.04](https://arriveddev.com/wp-content/uploads/2022/04/how-to-install-elasticsearch-7-x-on-ubuntu-20.04-22.04-4.jpg)
or use the command below
curl -X GET http://localhost:9200
![config Elasticsearch](https://arriveddev.com/wp-content/uploads/2022/04/how-to-install-elasticsearch-7-x-on-ubuntu-20.04-22.04-5.jpg)
After completing the steps, you have successfully installed Elasticsearch 7 on Ubuntu. Continue exploring and leveraging Elasticsearch’s powerful search and data analysis capabilities.
– Advertising –