Installation of Elasticsearch on CentOS 8
Since Elasticsearch is written in Java, the first step is to have Java installed on CentOS 8 Operating system.
Step 1: Install Java on CentOS 8
Java can be installed on your CentOS 8 machine by installing the JRE(Java Runtime Environment). The OpenJDK package is available in the CentOS 8 package repository, and you can install the latest version by typing the command given below.
After the installation of OpenJDK, check the installed version.
You can see that version 11.0.9.1 of OpenJDK is successfully installed on the CentOS 8 machine. Let’s install Elasticsearch now.
Step 2: Download and Install Elasticsearch on CentOS 8
Elastic provides all the packages to install Elasticsearch on any Operating system like deb, tar.gz, or rpm. For CentOS 8, we will definitely need the rpm package to install Elasticsearch on CentOS 8. You can visit their official website, elastic.co, to download and install the latest stable version of Elastic search on CentOS 8.
The latest and stable released version of Elasticsearch is 7.11.0 while writing this post. Download and install elastic search program using the following command:
For the future, just visit the download page of Elasticsearch, copy the link address of the RPM package, and paste it at the place of the link in the above command or you can just change the version number in the above command from 7.10.2 to the latest available version.
Once Elasticsearch is installed, the next step is to enable the elastic search.
First, reload the daemon using the command.
After reloading the daemon, enable the service of Elasticsearch.
Step 3: Configuration of Elasticsearch on CentOS 8
After the installation of Elasticsearch, if you want to configure Elastic search according to your desire, the configuration files of Elasticsearch are placed in the /etc/elasticsearch directory. For example, if you want to change the server or cluster name or configure the elastic search for remote access, all these types of configuration options are placed inside the elasticsearch.yml file.
elasticsearch.yml
For server settings and configuration, all the options are in this file.
Open up the elasticsearch.yml file in a nano text editor in the terminal.
And uncomment the lines that start from “node.name” and “cluster.name” and provide your desired names to change the name of the server and cluster, respectively.
Cluster. name: newClusterName
Similarly, if you want to configure the elastic search for remote access, uncomment the line that starts with the “network.host” if it is commented and provides the remote host’s IP address.
After all the configurations, save the file and exit using the shortcut keys (CTRL+S) and (CTRL+X).
After changing the configuration file to apply changes, we need to restart the Elasticsearch service.
Configuration of Elastic search is saved and applied successfully.
Conclusion
This is how we can install Elastic search on the CentOS 8 Operating system and configure it according to our requirements. By using Elasticsearch, we can perform a website search, application search, Application performance monitoring, Business and Security Analytics, and much more tasks. To learn more about Elasticsearch, read the getting started guide of Elasticsearch from its official website.