{"id":2726,"date":"2019-04-28T23:32:58","date_gmt":"2019-04-28T20:32:58","guid":{"rendered":"https:\/\/kifarunix.com\/?p=2726"},"modified":"2019-04-28T23:32:59","modified_gmt":"2019-04-28T20:32:59","slug":"install-elasticsearch-7-x-on-centos-7-fedora-29","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-elasticsearch-7-x-on-centos-7-fedora-29\/","title":{"rendered":"Install Elasticsearch 7.x on CentOS 7\/Fedora 29"},"content":{"rendered":"\n<p>This guide will take you through how to install Elasticsearch 7.x on CentOS 7\/Fedora 29. <a rel=\"noreferrer noopener\" aria-label=\"Elasticsearch (opens in a new tab)\" href=\"https:\/\/www.elastic.co\/products\/elasticsearch\" target=\"_blank\">Elasticsearch<\/a> is the heart of Elastic Stack.<\/p>\n\n\n\n<p>Our previous guide described how to install Elasticsearch 7.x on Ubuntu 18.04\/Debian 9.8.<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-elasticsearch-7-x-on-ubuntu-18-04-debian-9-8\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Install Elasticsearch 7.x on Ubuntu 18.04\/Debian 9.8<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Install Elasticsearch 7.x on CentOS 7\/Fedora 29<\/h2>\n\n\n\n<p>Again, you can install Elasticsearch using the tar.gz archive, RPM package or from RPM repository. We will discuss the use of RPM and RPM repository in this guide.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"mce_3\">Install Elasticsearch 7.x using RPM Repository<\/h3>\n\n\n\n<p>To install Elasticsearch 7.x on CentOS 7\/Fedora 29 using the RPM repository, perform system update before proceeding<\/p>\n\n\n\n<p>On CentOS 7<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum update<br>yum upgrade<\/code><\/pre>\n\n\n\n<p>On Fedora 29<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<br>dnf upgrade<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Import the Elasticsearch PGP Key<\/h4>\n\n\n\n<p>Once the system upgrade is done, run the command below to import the Elasticsearch PGP Signing Key.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>rpm --import https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Add Elasticsearch 7.x RPM Repository<\/h4>\n\n\n\n<p>To add the Elasticsearch 7.x repository that will allow you to install Elasticsearch 7.0.0 on CentOS 7\/Fedora 29, run the command below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat > \/etc\/yum.repos.d\/elastic-7.x.repo &lt;&lt; EOF\n[elasticsearch-7.x]\nname=Elasticsearch repository for 7.x packages\nbaseurl=https:\/\/artifacts.elastic.co\/packages\/7.x\/yum\ngpgcheck=1\ngpgkey=https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch\nenabled=1\nautorefresh=1\ntype=rpm-md\nEOF<\/code><\/pre>\n\n\n\n<p>Once you have created the Elasticsearch repository, update your system and install Elasticsearch.<\/p>\n\n\n\n<p>On CentOS 7<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum update<br>yum install elasticsearch<\/code><\/pre>\n\n\n\n<p>On Fedora 29<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>dnf update<br>dnf install elasticsearch<\/code><\/pre>\n\n\n\n<p>If the installation is successful, you should be able to see such an output snippet.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nCreating elasticsearch group... OK\nCreating elasticsearch user... OK\n\n  Installing       : elasticsearch-7.0.0-1.x86_64                                                                                                  1\/1 \n  Running scriptlet: elasticsearch-7.0.0-1.x86_64                                                                                                  1\/1 \n### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd\n sudo systemctl daemon-reload\n sudo systemctl enable elasticsearch.service\n### You can start elasticsearch service by executing\n sudo systemctl start elasticsearch.service\n\nCreated elasticsearch keystore in \/etc\/elasticsearch\n\n  Verifying        : elasticsearch-7.0.0-1.x86_64                                                                                                  1\/1 \n\nInstalled:\n  elasticsearch-7.0.0-1.x86_64                                                                                                                         \n\nComplete!<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Install Elasticsearch 7.x using RPM package<\/h2>\n\n\n\n<p>To manually install Elasticsearch 7.0 on CentOS 7\/Fedora 29 using RPM package, download the RPM package.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/artifacts.elastic.co\/downloads\/elasticsearch\/elasticsearch-7.0.0-x86_64.rpm<\/code><\/pre>\n\n\n\n<p>Next, download the checksum for verifying the integrity of the RPM package.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>wget https:\/\/artifacts.elastic.co\/downloads\/elasticsearch\/elasticsearch-7.0.0-x86_64.rpm.sha512<br><\/code><\/pre>\n\n\n\n<p>Run the integrity check by comparing the checksums. Before that, install <code>perl-Digest-SHA -y<\/code> which provides shasum for checksum comparison.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>yum install perl-<code>Digest-SHA -y<\/code><br>dnf install perl-Digest-SHA -y<br>shasum -a 512 -c elasticsearch-7.0.0-x86_64.rpm.sha512<br><\/code><\/pre>\n\n\n\n<p>If all is well, then you will get an OK output.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>elasticsearch-7.0.0-x86_64.rpm: OK<\/code><\/pre>\n\n\n\n<p>Next, Install Elasticsearch 7.0.0 on CentOS 7\/Fedora 29<\/p>\n\n\n\n<p>On CentOS 7<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo yum localinstall elasticsearch-7.0.0-x86_64.rpm<\/code><\/pre>\n\n\n\n<p>On Fedora 29<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo dnf install .\/elasticsearch-7.0.0-x86_64.rpm<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Running Elasticsearch<\/h2>\n\n\n\n<p>Once the installation is done, you can start elasticsearch service by executing;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl daemon-reload<br>systemctl start elasticsearch<\/code><\/pre>\n\n\n\n<p>To  stop or configure elasticsearch service to start automatically on system boot, run the commands below respectively.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl stop elasticsearch<br>systemctl enable elasticsearch<\/code><\/pre>\n\n\n\n<p>To check the status;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>systemctl status elasticsearch<br> \u25cf elasticsearch.service - Elasticsearch<br>    Loaded: loaded (\/usr\/lib\/systemd\/system\/elasticsearch.service; disabled; vendor preset: disabled)<br>    Active: active (running) since Sun 2019-04-28 23:21:53 EAT; 8s ago<br>      Docs: http:\/\/www.elastic.co<br>  Main PID: 25905 (java)<br>    CGroup: \/system.slice\/elasticsearch.service<br>            \u251c\u250025905 \/usr\/share\/elasticsearch\/jdk\/bin\/java -Xms1g -Xmx1g -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInit\u2026<br>            \u2514\u250025969 \/usr\/share\/elasticsearch\/modules\/x-pack-ml\/platform\/linux-x86_64\/bin\/controller<br> Apr 28 23:21:53 Cent7.example.com systemd[1]: Started Elasticsearch.<br> Apr 28 23:21:54 Cent7.example.com elasticsearch[25905]: OpenJDK 64-Bit<\/code><\/pre>\n\n\n\n<p>You can also use curl to check the status.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -X GET \"localhost:9200\/\"\n{\n  \"name\" : \"Cent7.example.com\",\n  \"cluster_name\" : \"elasticsearch\",\n  \"cluster_uuid\" : \"_C5MBUk4So6v7e0qQvRv_g\",\n  \"version\" : {\n    \"number\" : \"7.0.0\",\n    \"build_flavor\" : \"default\",\n    \"build_type\" : \"rpm\",\n    \"build_hash\" : \"b7e28a7\",\n    \"build_date\" : \"2019-04-05T22:55:32.697037Z\",\n    \"build_snapshot\" : false,\n    \"lucene_version\" : \"8.0.0\",\n    \"minimum_wire_compatibility_version\" : \"6.7.0\",\n    \"minimum_index_compatibility_version\" : \"6.0.0-beta1\"\n  },\n  \"tagline\" : \"You Know, for Search\"\n}<\/code><\/pre>\n\n\n\n<p>If FirewallD is running, you need to open tcp port 9200 on it.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>sudo firewall-cmd --add-port=9200\/tcp --permanent<br>sudo firewall-cmd --reload<\/code><\/pre>\n\n\n\n<p>Great, that is all it takes to install Elasticsearch 7.0 on CentOS 7\/Fedora 29. We will cover more about Elastic Stack in our next tutorials. Enjoy.<\/p>\n\n\n\n<p>Reference:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/rpm.html#rpm-repo\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\"Install Elasticsearch with RPM (opens in a new tab)\">Install Elasticsearch with RPM<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This guide will take you through how to install Elasticsearch 7.x on CentOS 7\/Fedora 29. Elasticsearch is the heart of Elastic Stack. Our previous guide<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[910,72],"tags":[88,912,911,913,289],"class_list":["post-2726","post","type-post","status-publish","format-standard","hentry","category-elastic-stack","category-monitoring","tag-centos-7","tag-elastic-stack","tag-elasticsearch-7-0","tag-elk","tag-fedora-29","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/2726"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=2726"}],"version-history":[{"count":1,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/2726\/revisions"}],"predecessor-version":[{"id":2727,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/2726\/revisions\/2727"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=2726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=2726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=2726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}