How To Install Elasticsearch on Fedora 35

Install Elasticsearch on Fedora 35

In this tutorial, we will show you how to install Elasticsearch on Fedora 35. For those of you who didn’t know, Elasticsearch is a highly scalable open-source analytics engine and full-text search. The software supports RESTful operations that allow you to store, search, and analyze significant volumes of data quickly and in near real-time.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Elasticsearch on a Fedora 35.

Prerequisites

  • A server running one of the following operating systems: Fedora 34 or Fedora 35.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo useror access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Elasticsearch on Fedora 35

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update

Step 2. Installing Java.

Elasticsearch depends on Java, you need it installed on your machine prior to installing Elasticsearch on Fedora. Run the following command to install the OpenJDK package:

sudo dnf install java-11-openjdk

Verify the Java version using the following command:

java -version

Step 3. Installing Elasticsearch on Fedora 35.

By default, Elasticsearch is not available on Fedora 35 base repository. Now we add the Elasticsearch RPM repository to your Fedora system:

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[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

Next, import the GPG key:

sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

Once is done, install the Elasticsearch package on your Fedora system:

sudo dnf update 
sudo dnf install elasticsearch

After the installation is complete, now enable Elasticsearch (to start automatically upon system boot), start, and verify the status using the commands below:

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch
sudo systemctl status elasticsearch

Step 4. Configure Elasticsearch.

Open Elasticsearch configuration file using your favorite text editor to edit configuration options if necessary:

nano /etc/elasticsearch/elasticsearch.yml

Add the following file:

cluster.name: Idroot-Cluster
node.name: node-1
path.data: /var/lib/elasticsearch
network.host: 127.0.0.1

Step 5. Configure Firewall.

If your server is protected by the firewall and you haven’t opened the Elasticsearch ports. Enable them with the following command below:

sudo firewall-cmd --permanent --add-port=9200/tcp
sudo firewall-cmd --permanent --add-port=9300/tcp
sudo firewall-cmd --reload

Step 6. Test Elasticsearch.

Once successfully installed, Now we test the Elasticsearch service to test if the installation is successful:

curl -X GET "localhost:9200/"

Output:

{
  "name" : "node-1",
  "cluster_name" : "Idroot-Cluster",
  "cluster_uuid" : "HY8HoLbmwe46b3QzXnTcmrQ",
  "version" : {
    "number" : "7.9.2",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "d34da0ea4a966c4e494gmbz44e3e97b4e6e",
    "build_date" : "2022-03-23T00:45:33.624620Z",
    "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"
}

Congratulations! You have successfully installed Elasticsearch. Thanks for using this tutorial for installing Elasticsearch on your Fedora 35 system. For additional help or useful information, we recommend you check the official Elasticsearch website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!