How to Install Elasticsearch on Linux Mint Latest

Elasticsearch is a powerful and scalable search engine that is used to search, analyze, and visualize large sets of data. It is built on top of the Apache Lucene library and is widely used in applications that require full-text search capabilities. In this tutorial, we will show you how to install Elasticsearch on Linux Mint Latest.

Prerequisites

Step 1 – Install Java

Elasticsearch is written in Java and requires a Java Runtime Environment (JRE) to run. Let's make sure that Java is installed on our system.

sudo apt update
sudo apt install default-jre

Verify that Java has been installed correctly by running the following command.

java -version

If everything is working correctly, you should see information about the installed version of Java.

Step 2 – Add Elasticsearch Repository

Elasticsearch is not included in the Linux Mint package repository, so we need to add the Elasticsearch repository to our system.

wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

After adding the Elasticsearch repository, update the package list.

sudo apt update

Step 3 – Install Elasticsearch

Now that we have added the Elasticsearch repository, we can install Elasticsearch using the following command.

sudo apt install elasticsearch

During the installation process, you will be prompted whether to allow Elasticsearch to start automatically when the system boots up. Choose "Yes" to allow this.

Step 4 – Configure Elasticsearch

Elasticsearch is now installed on your system, but we need to configure it before we can start using it. The configuration file is located at /etc/elasticsearch/elasticsearch.yml.

Open the file using your favorite text editor.

sudo nano /etc/elasticsearch/elasticsearch.yml

Edit the following lines to set the values according to your needs.

cluster.name: my-cluster
node.name: my-node
network.host: 0.0.0.0

We have set the cluster name to my-cluster, node name to my-node, and opened up Elasticsearch to listen on all network interfaces by setting network.host: 0.0.0.0.

Save the file and close it.

Step 5 – Start Elasticsearch

We can now start Elasticsearch using the following command.

sudo systemctl start elasticsearch

Verify that Elasticsearch has started correctly by running the following command.

sudo systemctl status elasticsearch

If Elasticsearch is running, you should see output that looks something like this.

● elasticsearch.service - Elasticsearch
     Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
     Active: active (running) since Fri 2021-06-18 10:55:27 UTC; 9s ago
       Docs: http://www.elastic.co
   Main PID: 18661 (java)
      Tasks: 19 (limit: 1137)
     Memory: 1.8G
     CGroup: /system.slice/elasticsearch.service
             └─18661 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.awt.headless

Step 6 – Configure Elasticsearch to Start at Boot

By default, Elasticsearch is not configured to start automatically when the system boots up. To enable automatic startup, run the following command.

sudo systemctl enable elasticsearch

Conclusion

Congratulations, you have successfully installed Elasticsearch on your Linux Mint Latest system. Elasticsearch will now launch automatically whenever your system boots up, and it can be accessed by other applications that need its search capabilities.

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!