Elasticsearch is a powerful open-source full-text search and analytics engine tool that allows you to store, search, and analyze large volumes of data in near real-time. It has become a go-to solution for businesses and developers looking for efficient and scalable search capabilities. In this article, we will guide you through the installation process of Elasticsearch on Rocky Linux 8, ensuring that you have all the necessary tools to harness the power of this robust search engine.
Installing Java
Before we begin the installation of Elasticsearch, we need to make sure that Java is installed on the system. Elasticsearch relies on Java, so it’s essential to have it set up properly. To install Java, open your terminal and run the following command:
dnf install java-11-openjdk-devel
To verify the installation of Java, use the following command:
java-version
If Java is installed correctly, you should see an output similar to the following:
openjdk version "11.0.11" 2021-04-20 LTS OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode, sharing)
Installing Elasticsearch
Once Java is installed, we can proceed with the installation of Elasticsearch. To get started, run the following command to import the GPG key for the Elasticsearch RPM packages:
rpm --importhttps://artifacts.elastic.co/GPG-KEY-elasticsearch
Next, create a yum repository file for Elasticsearch using your preferred text editor. For example, you can use nano:
nano /etc/yum.repos.d/elasticsearch.repo
Add the following content to 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.
Once the repository is enabled, you can install Elasticsearch by running the following command:
dnf install elasticsearch
After the installation is complete, Elasticsearch should be ready to be configured.
Configuring Elasticsearch
To configure Elasticsearch, we need to edit the Elasticsearch configuration file located at “/etc/elasticsearch/elasticsearch.yml”. Open the file in your preferred text editor:
vim /etc/elasticsearch/elasticsearch.yml
Within the file, locate the “network.host” parameter and set its value to “localhost”. This ensures that Elasticsearch only listens on the local interface. Add the following content to the file:
cluster.name: Crowncloud-Cluster node.name: node-1 path.data: /var/lib/elasticsearch network.host: 127.0.0.1
Save and exit the file.
Once the configuration is set, you can enable and start the Elasticsearch service using the following commands:
systemctl enable elasticsearch systemctl start elasticsearch
To check the status of the service, use the following command:
systemctl status elasticsearch
If Elasticsearch is running successfully, you will see an output similar to the following:
● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2021-05-27 17:26:14 EDT; 12min ago Docs: https://www.elastic.co Process: 82908 ExecStart=/usr/share/elasticsearch/bin/systemd-entrypoint -p ${PID_DIR}/elasticsearch.pid --quiet (code=exited, status=0/SUCCESS) Main PID: 82908 (java) Tasks: 55 (limit: 11394) Memory: 1.1G CGroup: /system.slice/elasticsearch.service ├─82908 /usr/share/elasticsearch/jdk/bin/java -Xshare:auto -Des.networkaddress.cache.ttl=60 -Des.networkaddress.cache.negative.t> └─83105 /usr/share/elasticsearch/modules/x-pack-ml/platform/linux-x86_64/bin/controller
Testing Elasticsearch
To ensure that Elasticsearch is up and running, we can use the following command to view the server configuration and version details:
curl -X GET "localhost:9200/"
If Elasticsearch is running correctly, you should see an output similar to the following:
{
"name" : "node-1",
"cluster_name" : "Crowncloud-cluster",
"cluster_uuid" : "G0GdHCQnRqe2ABCp9EMD3Q",
"version" : {
"number" : "7.13.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "5ca8591c6fcdb1260ce95b08a8e023559635c6f3",
"build_date" : "2021-05-19T22:22:26.081971330Z",
"build_snapshot" : false,
"lucene_version" : "8.8.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
Congratulations! You have successfully installed and configured Elasticsearch on Rocky Linux 8. You now have a powerful search and analytics engine at your disposal, ready to handle large volumes of data in near real-time.
Conclusion
In this article, we have walked you through the step-by-step process of installing Elasticsearch on Rocky Linux 8. By following these instructions, you now have the necessary tools to harness the power of this robust search and analytics engine. Elasticsearch will enable you to store, search, and analyze large volumes of data efficiently and in near real-time.
Remember that Elasticsearch is a versatile tool with many advanced features and capabilities. As you explore its functionalities, you will discover its potential to enhance your search capabilities and improve your data analysis processes.
If you are looking for reliable and scalable cloud hosting solutions, consider Shape.host’s Cloud VPS services. Shape.host offers high-performance virtual private servers that are optimized for Elasticsearch and other data-intensive applications. With Shape.host, you can trust that your Elasticsearch deployment will be backed by a dependable and knowledgeable team, ensuring optimal performance and security.