Wednesday, October 9, 2024
Google search engine
HomeData Modelling & AIHow To Install Elasticsearch on Fedora 37/36/35/34/33

How To Install Elasticsearch on Fedora 37/36/35/34/33

Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multi-tenant full-text search engine with an HTTP web interface and schema-free JSON documents. In this guide, we will cover the installation of Elasticsearch 8.x/7.x/6.x on Fedora 37/36/35/34/33. Elasticsearch is a highly scalable open-source analytics engine and full-text search. With Elasticsearch, you can store, search, and analyze big volumes of data faster and in near real-time.

Some key features of Elasticsearch include:

  • Distributed and highly available search engine: Elasticsearch is designed to be run on a cluster of machines, with each instance called a “node”. This allows for horizontal scalability and high availability of the search functionality.
  • Real-time search and analytics: Elasticsearch can search and analyze large volumes of data in near real-time, making it suitable for use cases such as log analysis, business intelligence, and website search.
  • Faceted search and filtering: Elasticsearch allows for faceting, which is a way to aggregate data based on certain criteria, and filtering, which allows to narrow down search results based on certain conditions.
  • Support for plugins and custom implementations:It has a plugin framework that allows for the addition of custom functionality and integration with other systems.

Follow the steps provided in this article to have a working installation of Elasticsearch 8/7/6 on Fedora 37/36/35/34/33/32.

For multi-node cluster, refer to:

Step 1: Install Java on Fedora

Elasticsearch depends on Java, you need it installed on your machine prior to installing Elasticsearch on Fedora. Default upstream version of OpenJDK can be installed on Fedora by running the commands:

sudo dnf install lsof java-17-openjdk java-17-openjdk-devel -y

After the installation of Java, you can quickly confirm the version using the following command:

$ java -version
openjdk version "17.0.5" 2022-10-18
OpenJDK Runtime Environment (Red_Hat-17.0.5.0.8-1.fc37) (build 17.0.5+8)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.5.0.8-1.fc37) (build 17.0.5+8, mixed mode, sharing)

Step 2: Install Elasticsearch on Fedora

After installing Java JDK, add Elasticsearch repository to your Fedora system.

1. Import GPG Key

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

2. Add Repository

For Elasticsearch 8.x

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elastic-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

For Elasticsearch 7.x

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

For Elasticsearch 6.x.

cat <<EOF | sudo tee /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

3.  Install Elasticsearch on Fedora

Elasticsearch repository is ready for use. You can install Elasticsearch using the command below:

sudo dnf install elasticsearch-oss||sudo dnf install elasticsearch

Hit the y key to start installation of Elasticsearch on Fedora:

...
Dependencies resolved.
======================================================================================================================================================================================================
 Package                                            Architecture                                Version                                        Repository                                        Size
======================================================================================================================================================================================================
Installing:
 elasticsearch                                      x86_64                                      8.6.0-1                                        elastic-8.x                                      555 M

Transaction Summary
======================================================================================================================================================================================================
Install  1 Package

Total download size: 555 M
Installed size: 1.1 G
Is this ok [y/N]: y

JVM options like memory limits are set on /etc/elasticsearch/jvm.options

sudo vi /etc/elasticsearch/jvm.options

Start and enable elasticsearch service on boot:

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

Check status:

$ systemctl status elasticsearch
 elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; preset: disabled)
     Active: active (running) since Wed 2023-01-25 15:43:27 UTC; 29s ago
       Docs: https://www.elastic.co
   Main PID: 1634 (java)
      Tasks: 87 (limit: 4543)
     Memory: 2.4G
        CPU: 55.074s
     CGroup: /system.slice/elasticsearch.service
             ├─1634 /usr/share/elasticsearch/jdk/bin/java -Xms4m -Xmx64m -XX:+UseSerialGC -Dcli.name=server -Dcli.script=/usr/share/elasticsearch/bin/elasticsearch -Dcli.libs=lib/tools/server-cli ->
             ├─1693 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -Djava.security.manager=allow -XX:+AlwaysPreTouch -Xss1m -Djava.>
             └─1714 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller

Jan 25 15:43:03 fedora.mylab.io systemd[1]: Starting elasticsearch.service - Elasticsearch...
Jan 25 15:43:27 fedora.mylab.io systemd[1]: Started elasticsearch.service - Elasticsearch.

Reset the password of the elastic built-in superuser

$ sudo /usr/share/elasticsearch/bin/elasticsearch-reset-password -u elastic -i
This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N] y


Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset.

Check if Elasticsearch is running (ELK 8)

$ sudo curl --cacert /etc/elasticsearch/certs/http_ca.crt -u elastic https://localhost:9200
Enter host password for user 'elastic':
{
  "name" : "fedora.mylab.io",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "6waXEZDFRUWEMrhMkQrf_w",
  "version" : {
    "number" : "8.6.0",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "f67ef2df40237445caa70e2fef79471cc608d70d",
    "build_date" : "2023-01-04T09:35:21.782467981Z",
    "build_snapshot" : false,
    "lucene_version" : "9.4.2",
    "minimum_wire_compatibility_version" : "7.17.0",
    "minimum_index_compatibility_version" : "7.0.0"
  },
  "tagline" : "You Know, for Search"
}

Step 3: Install Kibana on Fedora

Kibana lets you visualize your Elasticsearch data and navigate the Elastic Stack. Install it after adding the repository using the command:

sudo dnf install -y kibana-oss||sudo dnf install -y kibana

Generate an enrollment token for Kibana (ELK 8)

sudo /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana

After a successful installation, configure Kibana

$ sudo vi /etc/kibana/kibana.yml
server.host: "0.0.0.0"
server.name: "kibana.example.com"
elasticsearch.url: "http://localhost:9200"

Change other settings as desired then start Kibana service:

sudo systemctl enable --now kibana

Access http://ip-address:5601 to open Kibana Dashboard:

elasticsearch kibana centos7 min

If you have an active firewall, you’ll need to allow access to Kibana port:

sudo firewall-cmd --add-port=5601/tcp --permanent
sudo firewall-cmd --reload

For Ubuntu users, check

Other Elasticsearch guides:

Reference books:

Best Books To Learn Elasticsearch / Kibana

RELATED ARTICLES

Most Popular

Recent Comments