Elasticsearch 7 Quickinstall

Install/uninstall script for Elasticsearch and Kibana running on Ubuntu 20.04.

Configure them as service running on localhost and install Elasticsearch Ingest-Attachment Plugin. Tested with Elasticsearch 7.17.4.

Install Elasticsearch and Kibana

#!/bin/bash
apt install elasticsearch kibana -y
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl enable kibana.service
echo y | elasticsearch-plugin install ingest-attachment

echo "patching elasticsearch.yml"
sed -i 's/#network\.host: 192\.168\.0\.1/network\.host: 127\.0\.0\.1/g' /etc/elasticsearch/elasticsearch.yml
sed -i 's/#http\.port: 9200/http\.port: 9200/g' /etc/elasticsearch/elasticsearch.yml
egrep "127|9200" /etc/elasticsearch/elasticsearch.yml

service elasticsearch start
service kibana start

echo "INSTALLED."

Elasticsearch is now configured and running on localhost Port 9200, as well as Kibana on Port 5601.

curl http://localhost:9200
{
  "name" : "elastics.ear.ch",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "BwofyZc2Sf6eYwvAE0hTCg",
  "version" : {
    "number" : "7.17.4",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "19878662c54c886ae49206c685d9f2051a9d6411",
    "build_date" : "2022-05-18T18:04:20.964345128Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Completely erase Elasticsearch and Kibana

Use carefully because all databases will also be deleted!

#!/bin/bash
apt purge elasticsearch kibana -y

rm -rf /var/lib/elasticsearch/
rm -rf /var/lib/kibana/

updatedb
locate elasticsearch
locate kibana

echo "REMOVED."

Elasticsearch and Kibana are now completely removed again, including all databases.