How to Install Elasticsearch on Ubuntu - MUO - MakeUseOf
Elasticsearch is a popular search and analytics engine that can be used for multiple applications including endpoint security and AI/ML research.
Let's take a look at how you can install Elasticsearch on your Ubuntu system in a few easy-to-follow steps.
What Is Elasticsearch?
Elasticsearch is a distributed search and analytics engine. It allows you to store, search, and analyze large volumes of data quickly and in near real-time.
Built on top of Apache Lucene, Elasticsearch offers powerful full-text search capabilities and a flexible query language. It is highly scalable, fault-tolerant, and can handle diverse data types. Elasticsearch is widely used for applications like log analysis, monitoring, and more.
Prerequisites to Install Elasticsearch
There is one important prerequisite to installing Elasticsearch on Ubuntu. As Elasticsearch is a Java application, you'll need JDK version 11 or higher installed and properly configured on your system.
Here's how to check if JDK is installed on Linux:
java --version
This command should output the Java version installed on your system. In case you receive a "command not found" or any other type of error, it could mean that you don't have Java installed.
You can either manually install JDK by downloading the tarball or install it through the package manager of your Linux distro. Ideally, installing via package managers is the way to go since it's much quicker and hassle-free than the former hands-on method.
Here's how you can install JDK on Ubuntu using the APT package manager:
sudo apt install openjdk-18-jdk
You can replace 18 in the command with any version of JDK higher than 11. Wait for the installation to finish and then rerun the command to check the Java version. This time around you should be seeing the version as output.
Step 1: Add the GPG Key and Update Repositories
Elasticsearch is not a part of the official Ubuntu repositories. To install Elasticsearch using APT, you need to add its source list and the GPG key.
Run the following commands to add the Elasticsearch package source and GPG key, and update the source list for APT:
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo gpg --dearmor -o /usr/share/keyrings/elastic.gpg
echo "deb [signed-by=/usr/share/keyrings/elastic.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-8.x.list
sudo apt update
You can change the "8" in the second command to "7" or another version number in case you wish to download a specific version of Elasticsearch.
Step 2: Install Elasticsearch With APT
Now you can install the Elasticsearch package with APT as you would install any regular package. Here's the command to install Elasticsearch on Ubuntu:
sudo apt install elasticsearch
Type in Y when prompted for permissions and wait for the installation to finish. Once installed, follow the steps that appear on the screen to configure Elasticsearch to integrate with Kibana or other data visualization software.
Step 3: Install Elasticsearch Using the DEB Package
In case you don't wish to use APT to install Elasticsearch, you have the option to download the DEB package provided on the official site and install it with the dpkg command.
First, download the DEB package using wget. Then, use the dpkg command with elevated privileges to install Elasticsearch:
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.8.2-amd64.deb
sudo dpkg -i elasticsearch-8.8.2-amd64.deb
Keep in mind that you might need to modify the command to match the version of Elasticsearch you want to install.
Download: Elasticsearch
Now You Know How to Install Elasticsearch on Ubuntu
Post-installation, you'll be able to combine Elasticsearch with Kibana, Fleet, or other software to meet your requirements.
Although the ELK stack is great for log monitoring in enterprise environments, it might be a bit overkill for your regular home network. You might want to check out an alternative and easier way to get started with logging on Linux.
Comments
Post a Comment