{"id":7472,"date":"2021-06-24T06:07:58","date_gmt":"2021-06-24T06:07:58","guid":{"rendered":"https:\/\/linuxways.net\/?p=7472"},"modified":"2021-06-24T06:07:58","modified_gmt":"2021-06-24T06:07:58","slug":"how-to-install-elasticsearch-on-centos-8","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/how-to-install-elasticsearch-on-centos-8\/","title":{"rendered":"How to Install Elasticsearch on CentOS 8"},"content":{"rendered":"<p>Elasticsearch is a distributed and open-source search and analytics engine used for storing, searching, and analyzing data. Popular for its speed, scalability, and powerful set of features, Elasticsearch is capable of addressing a number of use cases like website searching, application performance monitoring, application search, Logging and log analytics, and much more.<\/p>\n<p>In today&#8217;s post, we are going to show how to install Elasticsearch on the CentOS system. For installing Elasticsearch on Ubuntu, visit this <a href=\"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-elasticsearch-on-ubuntu-20-04\/\">post<\/a>.<\/p>\n<p><strong>Note:<\/strong> The method shown here has been tested on <strong>CentOS 8<\/strong>. Also, note that you will need to either log in as a root user or run the installation commands.<\/p>\n<h2>Step 1: Downloading Elasticsearch<\/h2>\n<p>As of June 2021, the latest version of Elasticsearch available on its official website is <strong>1.13.2<\/strong>. To download Elasticsearch <strong>7.13.2<\/strong>, you can either use the commands described here or you can visit the Elasticsearch website page for the latest or any other previous version.<\/p>\n<p>Use the following commands to download Elasticsearch version 7.13.2 and its checksum:<\/p>\n<pre>$ wget https:\/\/artifacts.elastic.co\/downloads\/elasticsearch\/elasticsearch-7.13.2-x86_64.rpm<\/pre>\n<pre>$ wget https:\/\/artifacts.elastic.co\/downloads\/elasticsearch\/elasticsearch-7.13.2-x86_64.rpm.sha512<\/pre>\n<p>On the other hand, to manually download Elasticsearch and its published checksum SHA file from website, visit the <a href=\"https:\/\/www.elastic.co\/downloads\/elasticsearch\">Downloads<\/a> page and download the RPM file and SHA file for the latest version. To download the previous version, visit <a href=\"https:\/\/www.elastic.co\/downloads\/past-releases#elasticsearch\">Past Releases<\/a>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"476\" class=\"wp-image-7473\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-629.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-629.png 840w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-629-300x170.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-629-768x435.png 768w\" sizes=\"auto, (max-width: 840px) 100vw, 840px\" \/><\/p>\n<p>After downloading the Elasticsearch and SHA file, you can verify the file integrity. With both Elasticsearch <strong>.rpm<\/strong> and published checksum file <strong>rpm.sha512<\/strong> in the current Terminal directory, run the following command in Terminal:<\/p>\n<pre>$ shasum -a 512 -c elasticsearch-7.13.2-x86_64.rpm.sha512<\/pre>\n<p>If the SHA checksum matches, you will get an <strong>OK<\/strong> along with the Elasticsearch filename in the output. Otherwise, a failed message will be displayed.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"779\" height=\"63\" class=\"wp-image-7474\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-630.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-630.png 779w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-630-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-630-768x62.png 768w\" sizes=\"auto, (max-width: 779px) 100vw, 779px\" \/><\/p>\n<h2>Step 2: Installing Elasticsearch<\/h2>\n<p>The downloaded Elasticsearch package is in <strong>.rpm<\/strong> format. This can be installed using the RPM package manager.<\/p>\n<p>Use the below command to install Elasticsearch on your system:<\/p>\n<pre>$ sudo rpm --install elasticsearch-7.13.2-x86_64.rpm<\/pre>\n<p>Make sure to replace <strong>elasticsearch-7.13.2-x86_64.rpm<\/strong> with your Elasticsearch package name if you have downloaded any other version.<\/p>\n<p>After running the installation command, you will see something similar to the result below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"788\" height=\"400\" class=\"wp-image-7475\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-631.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-631.png 788w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-631-300x152.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-631-768x390.png 768w\" sizes=\"auto, (max-width: 788px) 100vw, 788px\" \/><\/p>\n<p>After the installation is completed, you will need to start and enable the Elasticsearch service using the commands below:<\/p>\n<pre>$ sudo systemctl start elasticsearch.service<\/pre>\n<pre>$ sudo systemctl enable elasticsearch.service<\/pre>\n<p>Now check the status of the service:<\/p>\n<pre>$ sudo systemctl status elasticsearch.service<\/pre>\n<p>The output below verifies that the Elasticsearch is running fine.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"799\" height=\"182\" class=\"wp-image-7476\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-632.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-632.png 799w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-632-300x68.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-632-768x175.png 768w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/p>\n<h2>Step 3: Configuring Elasticsearch<\/h2>\n<p>Elasticsearch is by default set up to listen just on the localhost. If you want to connect Elasticsearch from any other host, you will need to configure the Elasticsearch and your firewall.<\/p>\n<p>First, you will need to configure Elasticsearch to listen on any other network interfaces. To do so, edit the <strong>elasticsearch.yml<\/strong> file.<\/p>\n<pre>$ sudo nano \/etc\/elasticsearch\/elasticsearch.yml<\/pre>\n<p>In the file, search and uncomment the line <strong>network.host:<\/strong>. Then change the IP address with your network interface name.<\/p>\n<pre>network.host: 192.168.72.192<\/pre>\n<p>Also, add your IP address in the <strong>discovery.seed_hosts<\/strong> variable by uncommenting it first.<\/p>\n<pre>discovery.seed_hosts: [\"localhost\", \"192.168.72.192\"]<\/pre>\n<p>There are other two variables that you might also want to change: <strong>node.name<\/strong> and <strong>cluster.name<\/strong>. The node specified by the <strong>node.name<\/strong> is an instance of Elasticsearch whereas cluster defined by the <strong>cluster.name <\/strong>is a collection of one or more nodes.<\/p>\n<p>To change the names of the node and cluster, search for <strong>node.name<\/strong> and <strong>cluster.name<\/strong> in the file. Then uncomment and rename them.<\/p>\n<pre>cluster.name: test-cluster\r\n\r\nnode.name: test-node<\/pre>\n<p>Now save the <strong>elasticsearch.yml<\/strong> file and restart the Elasticsearch service:<\/p>\n<pre>$ sudo service elasticsearch restart<\/pre>\n<p>Now you will need to add a firewall rule to allow access from any other trusted host (Let\u2019s say 192.168.72.200 in our case) to TCP port 9200:<\/p>\n<pre>$ sudo firewall-cmd --permanent --add-source=192.168.72.200\r\n\r\n$ sudo firewall-cmd --permanent --add-port=9200\/tcp<\/pre>\n<p>Make sure to replace <strong>192.168.72.200<\/strong> with the IP address of your trusted host.<\/p>\n<p>Then reload firewall:<\/p>\n<pre>$ sudo firewall-cmd --reload<\/pre>\n<h2>Step 4: Testing Elasticsearch<\/h2>\n<p>By default, Elasticsearch listens for HTTP traffic on port 9200 on localhost or on a different interface address if you have configured it.<\/p>\n<p>To verify it, send a GET request to port 9200 on <strong>localhost<\/strong> or on the configured <strong>IP address<\/strong> using the command below in the Terminal:<\/p>\n<pre>$ curl -X GET \u201chttp:\/\/localhost:9200\u201d<\/pre>\n<p>Or<\/p>\n<pre>$ curl -X GET \u201chttp:\/\/&lt;ip-address&gt;:9200\u201d<\/pre>\n<p>You should see the following output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"637\" height=\"397\" class=\"wp-image-7477\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-633.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-633.png 637w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-633-300x187.png 300w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/p>\n<p>In this post, we covered the installation and basic configuration of Elasticsearch on the CentOS system. For how to use Elasticsearch, visit the <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/getting-started.html\">Quick start<\/a> guide available on its website.<\/p>","protected":false},"excerpt":{"rendered":"<p>Elasticsearch is a distributed and open-source search and analytics engine used for storing, searching, and analyzing data. Popular for its speed, scalability, and powerful set of features, Elasticsearch&hellip;<\/p>","protected":false},"author":1,"featured_media":7653,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[93,358],"class_list":["post-7472","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","tag-centos-8","tag-elasticsearch"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=7472"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/7472\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/7653"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=7472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=7472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=7472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}