How to Install Elasticsearch on OpenSUSE Latest

Elasticsearch is a fast, scalable, and open-source search engine. It is widely used for a range of applications, including aggregating data from different sources, indexing and searching large datasets, and performing analytical tasks.

In this tutorial, we will guide you through the installation of Elasticsearch on the OpenSUSE latest version.

Prerequisites

Step 1: Import GPG Key for Elasticsearch

Elastic provides its packages signed with its GPG key. Before installing Elasticsearch on your system, you should import the GPG key to ensure package integrity.

To import the GPG key, run the following command:

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

Step 2: Add Elasticsearch Repository

Elastic provides repositories for RedHat, CentOS, and OpenSUSE. We need to add Elasticsearch repository to our system.

To add a repository, create a new file called elasticsearch.repo in the /etc/zypp/repos.d directory using the following command:

sudo vi /etc/zypp/repos.d/elasticsearch.repo

Then, copy and paste the following contents in the file:

[elasticsearch-7.x]
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

Save and exit the file.

Step 3: Install Elasticsearch

To install Elasticsearch, update the package manager and run the following command:

sudo zypper install elasticsearch

After installation, start the Elasticsearch server using the following command:

sudo systemctl start elasticsearch.service

You can check if Elasticsearch is running by running the command:

sudo systemctl status elasticsearch.service

You should see something like the following output:

● elasticsearch.service - Elasticsearch
   Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2021-07-05 12:48:12 UTC; 6s ago
     Docs: http://www.elastic.co
 Main PID: 8616 (java)
    Tasks: 21 (limit: 2310)
   Memory: 2.8G
   CGroup: /system.slice/elasticsearch.service
           └─8616 /usr/share/elasticsearch/jdk/bin/java -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.ttl=10 -XX:+AlwaysPreTouch -Xss1m -Djava.io.tmpdir=/tmp/elasticsearch.qlnAo>

Step 4: Configure Elasticsearch

Elasticsearch configuration file is located at /etc/elasticsearch/elasticsearch.yml. You can edit the configuration file to change Elasticsearch settings.

For example, you can change the cluster name by modifying the following line in the configuration file:

cluster.name: my_cluster_name

After modifying the configuration file, restart Elasticsearch service to apply the changes:

sudo systemctl restart elasticsearch.service

Step 5: Test Elasticsearch

To test Elasticsearch installation, you can use the Elasticsearch curl command to get the cluster health:

curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'

You should see something like the following output:

{
  "cluster_name" : "my_cluster_name",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 0,
  "active_shards" : 0,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

This indicates that Elasticsearch is up and running.

Conclusion

That’s it! You have successfully installed Elasticsearch on your OpenSUSE system. You can now start using Elasticsearch for your search and analytical needs.

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!