Elasticsearch is a modern search and analytics engine based on Apache Lucene. It is fully open source and built with Java. It stores data as documents and provides APIs for full-text search. Elasticsearch is distributed under the Apache 2 license, which offers flexibility.
This tutorial will help you install and configure Elasticsearch on Fedora Linux systems.
Prerequisites
Java is the primary requirement for running Elasticsearch. We assume Java is already installed on your Fedora system.
You can use the following command to install OpenJDK Java on your system. Open a terminal and run:
sudo dnf install java-11-openjdk
After installation, check the Java version:
java -version
Step 1 – Install Elasticsearch on Fedora
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
Then create a repository file named elasticsearch.repo/etc/yum.repos.d
[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 and close this file.
- Clear the dnf cache and install the Elasticsearch package on your Fedora system:
sudo dnf clean
sudo yum install elasticsearch
The Elasticsearch RPM package has been installed. Next, you need to configure Elasticsearch according to your environment.
Step 2 – Configure Elasticsearch
Edit the Elasticsearch configuration file elasticsearch.ymland set network.host to localhost. To make it reachable over the network, you can also change it to the system's LAN IP address.
vim /etc/elasticsearch/elasticsearch.yml
network.host: localhost
Then enable and start Elasticsearch
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
Elasticsearch has been successfully installed and is running on your Fedora system.
Step 3 – Test Elasticsearch
Elasticsearch listens on port 9200 for its REST APIs. Port 9300 is used by Elasticsearch for communication between nodes.
Let's connect to port 5200 through the REST API to display the Elasticsearch version.
curl -X GET "localhost:9200/?pretty"
You will see results like the following:
{
"name" : "kockerim",
"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"
}