Installing Elasticsearch on Ubuntu
Author: Al-mamun Sarkar
Date: 2021-03-23 17:59:46
Elasticsearch has been developed using Java Programming language. So Java has to be installed on your computer to install Elasticsearch. You can check the Java version using the following command.
Check Java:
java -version
If Java is not installed you can install it using the following command.
sudo apt-get install openjdk-8-jdk
Adding Elastic Repository:
Import the PGP key for Elastic:
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Install apt-transport-https:
sudo apt-get install apt-transport-https
Add Elastic to your computer repository list:
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
Install Elasticsearch Package:
sudo apt-get update
sudo apt-get install elasticsearch
Configure Elasticsearch:
Uncomment and change network.host to localhost and uncomment http.port:
network.host: localhost
http.port: 9200
Start Elasticsearch:
sudo systemctl start elasticsearch
Check Elasticsearch Status:
sudo systemctl status elasticsearch
Stop Elasticsearch:
sudo systemctl stop elasticsearch
Restart Elasticsearch:
sudo systemctl restart elasticsearch
Starting on boot:
sudo systemctl enable elasticsearch.service
Test Elasticsearch:
curl -X GET http://localhost:9200
Or Run http://localhost:9200 on the browser.
You will get the following output:
{
"name" : "mamun",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "WGNg0KLfRMaEye9EVZXOWg",
"version" : {
"number" : "7.12.0",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "78722783c38caa25a70982b5b042074cde5d3b3a",
"build_date" : "2021-03-18T06:17:15.410153305Z",
"build_snapshot" : false,
"lucene_version" : "8.8.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}