How to Install Elasticsearch without Java for Magento 2.4.3?

As we know, we should install elasticsearch 7 for Magento 2.4.3. If we do not have installed asticsearch 7, usually we should install java on our web hosting first, then we can install asticsearch 7. Today I share another method to install asticsearch 7 without java-1.8.0-openjdk. I have tested the method under Nginx, php7.4, ubuntu18.0.4 and ubuntu 20.0.4 for https://www.prescriptionglassesonline.net/

First, install the required dependencies with the following command:

$ sudo apt install apt-transport-https ca-certificates gnupg2 -y

Then, we need to import the GPG key with the following command:

$ wget -O – http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add –

or

$ wget -qO – https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add –

At last, we can run the following command to add the Elasticsearch repository:

sudo sh -c ‘echo “deb https://artifacts.elastic.co/packages/7.x/apt stable main” > /etc/apt/sources.list.d/elastic-7.x.list’

We need to update the repository cache to be able to install the Elasticsearch with the following command:

$ sudo apt update -y
$ sudo apt install elasticsearch -y

That’s it, elasticsearch has been successfully installed. We can enable the service and start it by running this command below:

$ sudo systemctl –now enable elasticsearch

To verify whether Elasticsearch is running or not we can run the following command:

$ curl -X GET “localhost:9200”
You will be presented with a message like this.

{
“name” : “prescriptionglasseonline”,
“cluster_name” : “elasticsearch”,
“cluster_uuid” : “NZxEtHQfSf2RtyegdPu0vQ”,
“version” : {
“number” : “7.16.2”,
“build_flavor” : “default”,
“build_type” : “deb”,
“build_hash” : “2b937c44140b6559905130a8650c64dbd0879cfb”,
“build_date” : “2021-12-18T19:42:46.604893745Z”,
“build_snapshot” : false,
“lucene_version” : “8.10.1”,
“minimum_wire_compatibility_version” : “6.8.0”,
“minimum_index_compatibility_version” : “6.0.0-beta1”
},
“tagline” : “You Know, for Search”
}