Elasticsearch is a modern search and analytics engine based on Apache Lucene. It is completely open-source and built with Java. It stored data in form of documents and provides APIs for the full-text search. Elasticsearch is distributed under the Apache 2 license, which provides it flexibility.
This tutorial will help you to install and configure Elasticsearch on Fedora Linux systems.
Prerequisites
Java is the primary requirement for running elasticsearch. We assume you already have Java installed on your Fedora system.
You can use following command to install OpenJDK java on your system. Open a terminal and execute:
sudo dnf install java-11-openjdk
After installation, check the Java version:
java -version
Step 1 – Install ElasticSearch on Fedora
- First of all, Download and install the Public Signing Key for elasticsearch:
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- Next create a repository file
elasticsearch.repo
in the directory/etc/yum.repos.d
and add below content to file.[Elasticsearch-7] 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 this file and close it.
- Clean the dnf cache and install elasticsearch package on your fedora system:
sudo dnf clean
sudo yum install elasticsearch
Elasticsearch RPM package has been installed. Next, you need to configure elasticsearch based on your environment.
Step 2 – Configure Elasticsearch
Edit the elasticsearch configuration file elasticsearch.yml
and set the network.host
to localhost. You can also change it to the system LAP IP address to make it accessible over the network.
vim /etc/elasticsearch/elasticsearch.yml
network.host: localhost
Then enable the elasticsearch service and start it.
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
The ElasticSearch has been successfully installed and running on your Fedora system.
Step 3 – Test Elasticsearch
Elasticsearch listens on port 9200 for the REST APIs. Port 9300 is used by the elasticsearch for communication between nodes.
Let’s connect on port 5200 via REST API to view the elasticsearch version.
curl -X GET "localhost:9200/?pretty"
You will see the results like below:
{ "name" : "tecadmin", "cluster_name" : "elasticsearch", "cluster_uuid" : "HY8HoLHnRCeb3QzXnTcmrQ", "version" : { "number" : "7.9.2", "build_flavor" : "default", "build_type" : "rpm", "build_hash" : "d34da0ea4a966c4e49417f2da2f244e3e97b4e6e", "build_date" : "2020-09-23T00:45:33.626720Z", "build_snapshot" : false, "lucene_version" : "8.6.2", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" }
As the the above connected node name is tecadmin running elasticsearch version 7.9.2.
Conclusion
In this tutorial, you have learned to install and configure Elasticsearch on the Fedora Linux system.