How to install the Elasticsearch analytics engine with a handy GUI on AlmaLinux

If your business needs a powerful search and analytics engine, Elasticsearch might be just the ticket. Jack Wallen shows you how to get this and a handy web browser add-on up and running.

big data search

Image: iStock/HAKINMHAN

Elasticsearch is a powerful search and analytics engine used by enterprises and businesses around the globe. With this platform, you can store, search and analyze big volumes of data and do so in near real time.

SEE: Electronic Data Disposal Policy (TechRepublic Premium)

I want to walk you through the steps of installing Elasticsearch and introduce you to a helpful GUI. The one thing about this combination you must understand is that it's not going to turn Elasticsearch into a point-and-click affair. You'll still want/need to know how to use Elasticsearch from the command line (I'll show you a couple of examples).

It's important you know that we're going to be installing Elasticsearch such that it's only reachable via localhost. Because of that, you'll want to use AlmaLinux with a desktop environment. I've attempted to configure Elasticsearch to accept network connections from outside of localhost, but any network configuration other than either localhost or 127.0.0.1 causes Elasticsearch to fail to run. I am not certain if this is a bug in the current release or an issue with AlmaLinux. I even tested this with SELinux disabled (don't do that) and the service still fails to start. Ergo ... localhost.

With that said, let's install.

What you'll need

To make this happen, you'll need a running instance of AlmaLinux and a user with sudo privileges. That's it. Let's get to work.

How to install Elasticsearch

The first thing we're going to do is enable the EPEL repo with the command:

sudo dnf install epel-release -y

Once that completes, enable EPEL groups with:

sudo dnf --enablerepo=epel group

Next, we have to install Java 11 with the command:

sudo dnf install java-11-openjdk-devel

Now, we can install the Elasticsearch GPG key with:

sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Create a yum repository file with:

sudo nano /etc/yum.repos.d/elasticsearch.repo

Paste the following into the new file:

[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Save and close the file. 

Update DNF and install Elasticsearch with:

sudo dnf update
sudo dnf install elasticsearch -y

How to configure Elasticsearch

Open the Elasticsearch configuration file with:

sudo nano /etc/elasticsearch/elasticsearch.yml

In that file, you'll want to edit the following two options:

#cluster.name:
#node.name:

Remove the # characters and then give each a name. It's important for cluster.name that you wrap it in quotes, as in:

cluster.name: "My Cluster"

Save and close the file.

Start and enable Elasticsearch with:

sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch

How to test Elasticsearch

The first thing you need to do is make sure you can connect to Elasticsearch. For that, issue the command:

curl -X GET "localhost:9200/"

You should see something like:

{
  "name" : "node-1",
  "cluster_name" : "Adorkable Cluster",
  "cluster_uuid" : "-plxw1g-TiurPS9OrHivrA",
  "version" : {
    "number" : "7.15.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "79d65f6e357953a5b3cbcc5e2c7c21073d89aa29",
    "build_date" : "2021-09-16T03:05:29.143308416Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

Next, we'll add data to our Elasticsearch instance (also using the curl command). Let's create an entry named trtest/blog/1 with a message of Hello, TechRepublic! For that, the command would be:

curl -H 'Content-Type: application/json' -X POST 'http://localhost:9200/trtest/blog/1' -d '{ "message": "Hello, TechRepublic!" }'

Retrieve the data we just added with the command:

curl -X GET 'http://localhost:9200/trtest/blog/1'

Elasticsearch should report back:

{"_index":"trtest","_type":"blog","_id":"1","_version":1,"_seq_no":0,"_primary_term":1,"found":true,"_source":{ "message": "Hello, TechRepublic!" }}

Congratulations, Elasticsearch is working.

How to use Elasticvue

Elasticvue is a browser add-on that allows you to connect to your Elasticsearch instance and features:

  • Cluster overview

  • Node overview

  • Index management

  • Index alias management

  • Document search

  • REST GUI

  • Snapshot and repository management

  • Utilities for cluster cleaning and test data addition

To install the app, head over to the official Elasticvue website and install the add-on for your browser of choice. Once you've installed the addon, open it and then, in the resulting window (Figure A), click TEST CONNECTION.

Figure A

elastica.jpg

Elasticvue installed on Firefox is ready for testing.

The connection test should pass, so click CONNECT and Elasticvue will be connected to your Elasticsearch instance (Figure B).

Figure B

elasticb.jpg

Elasticvue is now connected to my instance of Elasticsearch.

One thing I highly recommend you do is go to UTILITIES and then click the RUN buttons for both Create 10 empty indices and Create twitter index and add 100 tweets. This will add test data to Elasticsearch that you can work within Elasticvue. Once you have a feel of how Elasticvue works, you can go back to UTILITIES and click RUN associated with Delete all indices.

And that's all there is to installing Elasticsearch and then adding a handy web browser add-on to view your instance. For many enterprise industries, tools like Elasticsearch are a must-have, so you should start getting up to speed with this tool as soon as you can.

Subscribe to TechRepublic's How To Make Tech Work on YouTube for all the latest tech advice for business pros from Jack Wallen.

Also see