How to Install Elasticsearch on Elementary OS Latest

Elasticsearch is an open-source, full-text search and analytics engine. It is used to index and store large volumes of data, and to perform complex search queries on this data. This tutorial will guide you through the steps to install Elasticsearch on Elementary OS Latest.

Prerequisites

Before getting started, you will need to have the following:

Step 1: Update system repositories

The first step is to update your system repositories to ensure that you are installing Elasticsearch from the latest available version. Open a terminal and type the following command:

sudo apt update

Step 2: Install Java on Elementary OS Latest

Elasticsearch requires Java to run. If you don't have Java installed on your system, you can install it by typing the following command:

sudo apt-get install openjdk-11-jdk

Verify the installation by checking the version by typing in the following:

java -version

Step 3: Download and install Elasticsearch

Go to the Elasticsearch download page (https://www.elastic.co/downloads/elasticsearch) and download the Elasticsearch package for your platform. To download the .tar.gz file run the command as github host:

wget https://github.com/elastic/elasticsearch/archive/PR_NUMBER.zip

Create a directory where you will install Elasticsearch:

sudo mkdir /usr/share/elasticsearch

Extract the downloaded file to the created directory:

sudo unzip PR_NUMBER.zip -d /usr/share/elasticsearch

Rename the extracted directory:

sudo mv /usr/share/elasticsearch/elasticsearch-PR_NUMBER /usr/share/elasticsearch/elasticsearch

Step 4: Configure Elasticsearch

By default, Elasticsearch is not configured to run as a service, we will configure Elasticseatch running as a systemd service.

Create a new file with the name /etc/systemd/system/elasticsearch.service:

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

Paste the following content into the file:

[Unit]
Description=Elasticsearch
After=network.target

[Service]
User=root
Group=root
LimitNOFILE=65535
Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
Environment=ES_HOME=/usr/share/elasticsearch/
ExecStartPre=/usr/share/elasticsearch/bin/elasticsearch-systemd-pre-exec
ExecStart=/usr/share/elasticsearch/bin/elasticsearch
Restart=always
SyslogIdentifier=elasticsearch

[Install]
WantedBy=multi-user.target

Save and close the file.

Reload systemd:

sudo systemctl daemon-reload

Then enable the Elasticsearch service:

sudo systemctl enable elasticsearch

You can now start Elasticsearch by running:

sudo systemctl start elasticsearch

Check the Elasticsearch status:

sudo systemctl status elasticsearch

Conclusion

You've successfully installed Elasticsearch on Elementary OS Latest. Now, you can start working with Elasticsearch!

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!