How to Install Elasticsearch on Fedora CoreOS

Elasticsearch is a powerful search engine and analytical platform that allows users to efficiently search and analyze large datasets. Fedora CoreOS is a lightweight, immutable Operating System that is designed for container workloads. In this tutorial, we will show you how to install Elasticsearch on Fedora CoreOS latest.

Prerequisites

Before proceeding with this tutorial, you will need:

Step 1: Update Fedora CoreOS

It is recommended to update the package repository before installing any new packages to ensure that you have the latest versions of software available. Run the following command to update your system:

sudo rpm-ostree upgrade

Step 2: Install Java

Elasticsearch requires Java to be installed on the system in order to run. Fedora CoreOS does not come with Java pre-installed, therefore we will need to install it manually. To install Java, run the following command:

sudo rpm-ostree install java-latest-openjdk

Step 3: Download Elasticsearch

Next, we need to download the Elasticsearch package. You can download the package from the official Elasticsearch website. To download the package, execute the following command:

sudo curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-x86_64.tar.gz

Step 4: Extract Elasticsearch

Once the package has been downloaded, we need to extract its contents:

sudo tar -xvf elasticsearch-7.15.0-linux-x86_64.tar.gz

Step 5: Configure Elasticsearch

By default, Elasticsearch runs with a configuration that is suitable for development purposes, but not for production. We need to update the Elasticsearch configuration to ensure that it runs optimally on our system.

Open the Elasticsearch configuration file in a text editor:

sudo vi elasticsearch-7.15.0/config/elasticsearch.yml

Update the configuration file settings based on your requirements. Here are some important settings that you may want to change:

Save the configuration file and exit the text editor.

Step 6: Start Elasticsearch

We are now ready to start Elasticsearch:

cd elasticsearch-7.15.0
sudo ./bin/elasticsearch

You should see some output indicating that Elasticsearch is starting up. Once Elasticsearch has started successfully, you can access its REST API at http://localhost:9200.

Step 7: Enable Elasticsearch to Start at Boot

By default, Elasticsearch does not start automatically when the system boots up. We can enable it to do so by creating a systemd service file.

Create the elasticsearch.service file using the following command:

sudo vi /etc/systemd/system/elasticsearch.service

Paste the following content into the file and save it:

[Unit]
Description=Elasticsearch
After=network-online.target

[Service]
User=root
WorkingDirectory=/var/lib/elasticsearch
LimitNOFILE=65536
ExecStart=/opt/elasticsearch-7.15.0/bin/elasticsearch
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Reload the systemd service files and enable the Elasticsearch service to start at boot:

sudo systemctl daemon-reload
sudo systemctl enable elasticsearch

Conclusion

Congratulations, you have successfully installed Elasticsearch on Fedora CoreOS latest. You should now be able to access the Elasticsearch REST API and start working with your data. For more information on Elasticsearch, please refer to the official Elasticsearch documentation.

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!