What is Elasticsearch?

elasticsearch logo

Elasticsearch is a distributed, open-source, full-text search engine which provides multi-tenant capabilities for analyzing multiple data types. It stores and indexes data shipped from sources like Logstash or Kibana. Elasticsearch can then be queried for specific data to return useful information about a particular application, log analysis, application performance data, or other information.

In this tutorial, we will cover how to install Elasticsearch on Ubuntu 18.04. Aggregating and transforming log information from disparate systems is an essential piece of application management and monitoring in a distributed system. Needing the capability to gather is important, but having the ability to contextualize it and be able to comb through it for relevant data is paramount. That’s where Elasticsearch comes in.

Preflight Check

  • A server running Ubuntu 18.04 LTS
  • This tutorial assumes there is a working installation of Java available on the server.
  • The user has a working knowledge of CLI in the terminal

Install Dependencies

Because Elasticsearch uses Java, we need to ensure the Java Development Kit (JDK) is installed. We can check for the Java installation on our Ubuntu server using this command.

root@ubuntu18:~$ java -version
 -bash: java: command not found

If Java is not installed, you can run the command below to install it or review our KB article for more detailed instructions.

root@ubuntu18:~$ apt install openjdk-8-jdk

Now, we can re-verify our Java JDK installation by running the following command again.

root@ubuntu18:~$ java -version
openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

Prepare the Environment

Next, as a best practice, we should update our system packages by running the following command.

root@ubuntu18:~## apt update -y

Next, we will run the following wget command to pull down and install the GPG Public Signing Key for the Logstash package repositories.

root@ubuntu18:~## apt update -y

The following step may or may not be necessary on all systems, but to be certain that all prerequisite packages are available, and we have access to all of our repositories via HTTPS, we will install the following software package called apt-transport-https.

root@ubuntu18:~## apt install apt-transport-https -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 1692 B of archives.
After this operation, 153 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 apt-transport-https all 1.6.12ubuntu0.1 [1692 B]
Fetched 1692 B in 1s (2311 B/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 35064 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.6.12ubuntu0.1_all.deb ...
Unpacking apt-transport-https (1.6.12ubuntu0.1) ...
Setting up apt-transport-https (1.6.12ubuntu0.1) ...
root@ubuntu18:~## 

Finally, we will install the Logstash repository and add it to our _/etc/apt/sources.list.d _file using the following command.

root@ubuntu18:~## echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

#tutorials #configuration #java #search #ubuntu #ubuntu 18.04 #ufw #yaml

How to Install and Configure Elasticsearch
2.65 GEEK