Install Elastic search 5.x in ubuntu 20, 18, 16
Look for OpenJDK in APT
sudo apt search openjdk
Install OpenJDK 8
sudo apt-get install openjdk-8-jdk
Add the proper GPG key for ElasticSearch
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
Make sure to install/update transport
sudo apt-get install apt-transport-https
Save the repo definition
echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-5.x.list
Update APT and install ElasticSearch from APT
sudo apt-get update && sudo apt-get install elasticsearch
Reload the daemon
sudo /bin/systemctl daemon-reload
Allow ElasticSearch to start on boot
sudo /bin/systemctl enable elasticsearch.service
Lets fire up ElasticSearch...
sudo systemctl start elasticsearch.service
Lets see if we have some logs
sudo ls -la /var/log/elasticsearch/
Have a look at the logs and make sure that ElasticSearch has properly initiated
sudo cat /var/log/elasticsearch/elasticsearch.log
If logs are looking good, You can CURL the ElasticSearch server
curl -XGET 'localhost:9200/?pretty'
Output:
{
"name" : "y-489FI",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "nltcKRHLTL6-aLX3o6auug",
"version" : {
"number" : "5.6.16",
"build_hash" : "3a740d1",
"build_date" : "2019-03-13T15:33:36.565Z",
"build_snapshot" : false,
"lucene_version" : "6.6.1"
},
"tagline" : "You Know, for Search"
}
Completely uninstall Elasticsearch from linux