How to Install Elasticsearch on Arch Linux

Overview

This tutorial will guide you through the process of installing Elasticsearch from https://www.elastic.co/ on Arch Linux.

Prerequisites

Step-by-Step Guide

  1. Open a terminal window on your Arch Linux system

  2. Run the following command to update your system package list and upgrade installed packages:

sudo pacman -Syu
  1. Elasticsearch is a Java-based application, so make sure you have Java installed on your system. Run the following command to check for the availability of Java on your system:
java -version

If Java is not installed, run the following command to install it:

sudo pacman -S jre-openjdk
  1. Now you can proceed to download and install Elasticsearch. Run the following command to download the Elasticsearch package:
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.1-linux-x86_64.tar.gz

You can replace the version number with the latest Elasticsearch version number available at the time of installing.

  1. Extract the downloaded package using the following command:
tar -xvf elasticsearch-7.15.1-linux-x86_64.tar.gz
  1. Move the extracted files to the /usr/share/elasticsearch directory with the following command:
sudo mv elasticsearch-7.15.1 /usr/share/elasticsearch
  1. Elasticsearch requires all of its data to be stored in a separate location from the installation directory. Therefore, you need to create a separate directory for data storage.
sudo mkdir /var/lib/elasticsearch
  1. Grant ownership of the newly created directory to the Elasticsearch user with the following command:
sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
  1. Configure Elasticsearch. Run the following command to open Elasticsearch's configuration file:
sudo nano /usr/share/elasticsearch/config/elasticsearch.yml
  1. In the configuration file, uncomment and modify the following lines to:
cluster.name: my_cluster_name
node.name: my_node_name
path.data: /var/lib/elasticsearch
path.logs: /usr/share/elasticsearch/logs
  1. Save the configuration file and exit the editor by pressing Ctrl+X, followed by Y and Enter.

  2. Install Elasticsearch as a service. Run the following command:

sudo /usr/share/elasticsearch/bin/elasticsearch-systemd-pre-units install
  1. Enable and start the Elasticsearch service by running the following commands:
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
  1. Verify that Elasticsearch is running by accessing its REST API endpoint:
curl -X GET "http://localhost:9200/"

If Elasticsearch is running successfully, then you'll receive a JSON output.

Conclusion

That's it! You have successfully installed Elasticsearch on your Arch Linux system! Elasticsearch is a powerful search engine that can be used to search, analyze, and visualize your data. We hope that you found this tutorial helpful.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!