{"id":2722,"date":"2012-04-03T16:53:03","date_gmt":"2012-04-03T16:53:03","guid":{"rendered":"https:\/\/supportex.net\/?p=2722"},"modified":"2019-05-10T16:41:50","modified_gmt":"2019-05-10T14:41:50","slug":"elasticsearch-installation-centos","status":"publish","type":"post","link":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/","title":{"rendered":"elasticsearch: installation and configuration on Centos 6.2"},"content":{"rendered":"<p>The installation of <a href=\"http:\/\/www.elasticsearch.org\">elasticsearch<\/a> (which is distributed RESTful, search engine built on top of Apache Lucene) on Centos, will be easier if it is in repositories. But it isn&#8217;t. And since the best way to install application on Centos is to use rpm packages we will need to build it. At the very beginning you need to install Java:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">yum install java-1.6.0-openjdk.x86_64<\/code><\/p>\n<p>To not write our own SPEC files we will use the one kindly written by Tavis Aitken. It could be downloaded from his <a href=\"https:\/\/github.com\/tavisto\/elasticsearch-rpms\/tarball\/master\">github page<\/a>. After unpacking copy SPEC file to your <em>~\/rpmbuild\/SPECS<\/em> directory. Besides you need to copy config files to <em>~\/rpmbuild\/SOURCES<\/em>.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">cp tavisto-elasticsearch-rpms-c78de68\/SPECS elasticsearch.spec rpmbuild\/SPECS\/\ncp tavisto-elasticsearch-rpms-c78de68\/SOURCES\/* rpmbuild\/SOURCES\/<\/pre>\n<p>If you don&#8217;t have ~\/rpmbuild directory you may need to install the packages <em>rpm-build<\/em> and\u00a0<em>rpmdevtools<\/em>, and run\u00a0<em>rpmdev-setuptree<\/em> command.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">yum install rpm-build rpmdevtools\nrpmdev-setuptree<\/pre>\n<p>I would recommend to use last version of <em>elasticsearch<\/em> (at the time of writing it&#8217;s 0.19.1) since there are a lot of bug fixes (for instance, this <a href=\"https:\/\/github.com\/elasticsearch\/elasticsearch\/issues\/1754\">one<\/a>). To do this you need to modify SPEC file to point to the last version:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">Version: 0.19.1<\/code><\/p>\n<p>Now we are ready to download the tarball:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">spectool -g rpmbuild\/SPECS\/elasticsearch.spec\nmv elasticsearch-0.19.1.tar.gz rpmbuild\/SOURCES\/elasticsearch-0.19.1.tar.gz<\/pre>\n<p>And finally build rpm and install it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">rpmbuild -bb rpmbuild\/SPECS\/elasticsearch.spec\nrpm -ivh rpmbuild\/RPMS\/x86_64\/elasticsearch-0.19.1-1.el6.x86_64.rpm<\/pre>\n<p>At this point we need to configure the application. Comment out all lines in <em>\/etc\/sysconfig\/elasticsearch<\/em>. After that configure <em>\/etc\/elasticsearch\/elasticsearch.yml<\/em> to fit your requirements. Here is a simple example:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">cluster.name: elasticsearch\nnode.name: \"Franz Kafka\"\npath.conf: \/etc\/elasticsearch\npath.data: \/var\/lib\/elasticsearch\npath.logs: \/var\/log\/elasticsearch\nnetwork.bind_host: _eth0:ipv4_\nnetwork.publish_host: _eth0:ipv4_\nnetwork.host: _eth0:ipv4_\ntransport.tcp.port: 9300\nhttp.port: 9200\ndiscovery.zen.ping.multicast.enabled: false<\/pre>\n<p>Start <em>elasticsearch<\/em> and make sure it&#8217;s running:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">service elasticsearch start\nnetstat -lpn | grep java\n<\/pre>\n<p>Enable auto-start:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">chkconfig elasticsearch on<\/code><\/p>\n<p>Note that for security reasons it would be a good idea to restrict access to <em>elasticsearch<\/em> with iptables.<\/p>\n<p>Now you can test if it&#8217;s working. You may PUT a data:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">curl -XPUT http:\/\/localhost:9200\/twitter\/tweet\/2 -d '{\n\"user\": \"kimchy\",\n\"post_date\": \"2009-11-15T14:12:12\",\n\"message\": \"You know, for Search\"\n}'<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">{\"ok\":true,\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"2\",\"_version\":1}<\/pre>\n<p>And then try to GET it:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">curl -XGET http:\/\/localhost:9200\/twitter\/tweet\/2<\/pre>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">{\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"2\",\"_version\":1,\"exists\":true, \"_source\" : {\n\"user\": \"kimchy\",\n\"post_date\": \"2009-11-15T14:12:12\",\n\"message\": \"You know, for Search\"\n}}<\/pre>\n<p>Seems it&#8217;s working. Let&#8217;s delete test data:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">curl -XDELETE 'http:\/\/localhost:9200\/twitter\/tweet\/1'<\/code><\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">{\"ok\":true,\"found\":false,\"_index\":\"twitter\",\"_type\":\"tweet\",\"_id\":\"1\",\"_version\":1}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The installation of elasticsearch (which is distributed RESTful, search engine built on top of Apache Lucene) on Centos, will be easier if it is in repositories. But it isn&#8217;t. And since the best way to install application on Centos is to use rpm packages we will need to build it. At the very beginning you&hellip; <\/p>\n<div class=\"readmore-wrapper\"><a href=\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\" class=\"more-link\">Read <\/a><\/div>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[152],"tags":[212,262,275],"class_list":["post-2722","post","type-post","status-publish","format-standard","hentry","category-linux","tag-centos-en","tag-elasticsearch-en","tag-linux"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog<\/title>\n<meta name=\"description\" content=\"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog\" \/>\n<meta property=\"og:description\" content=\"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos\" \/>\n<meta property=\"og:url\" content=\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\" \/>\n<meta property=\"og:site_name\" content=\"Supportex.NET blog\" \/>\n<meta property=\"article:published_time\" content=\"2012-04-03T16:53:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-05-10T14:41:50+00:00\" \/>\n<meta name=\"author\" content=\"Oleksii Tykhonov\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Oleksii Tykhonov\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\"},\"author\":{\"name\":\"Oleksii Tykhonov\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"headline\":\"elasticsearch: installation and configuration on Centos 6.2\",\"datePublished\":\"2012-04-03T16:53:03+00:00\",\"dateModified\":\"2019-05-10T14:41:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\"},\"wordCount\":279,\"keywords\":[\"CentOS\",\"elasticsearch\",\"linux\"],\"articleSection\":[\"linux\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\",\"url\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\",\"name\":\"elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog\",\"isPartOf\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\"},\"datePublished\":\"2012-04-03T16:53:03+00:00\",\"dateModified\":\"2019-05-10T14:41:50+00:00\",\"author\":{\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\"},\"description\":\"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos\",\"breadcrumb\":{\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/supportex.net\/blog\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"elasticsearch: installation and configuration on Centos 6.2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#website\",\"url\":\"https:\/\/supportex.net\/blog\/en\/\",\"name\":\"Supportex.NET blog\",\"description\":\"Server and network management company\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251\",\"name\":\"Oleksii Tykhonov\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g\",\"caption\":\"Oleksii Tykhonov\"},\"url\":\"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog","description":"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/","og_locale":"en_US","og_type":"article","og_title":"elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog","og_description":"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos","og_url":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/","og_site_name":"Supportex.NET blog","article_published_time":"2012-04-03T16:53:03+00:00","article_modified_time":"2019-05-10T14:41:50+00:00","author":"Oleksii Tykhonov","twitter_misc":{"Written by":"Oleksii Tykhonov","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#article","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/"},"author":{"name":"Oleksii Tykhonov","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"headline":"elasticsearch: installation and configuration on Centos 6.2","datePublished":"2012-04-03T16:53:03+00:00","dateModified":"2019-05-10T14:41:50+00:00","mainEntityOfPage":{"@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/"},"wordCount":279,"keywords":["CentOS","elasticsearch","linux"],"articleSection":["linux"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/","url":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/","name":"elasticsearch: installation and configuration on Centos 6.2 &#8211; Supportex.NET blog","isPartOf":{"@id":"https:\/\/supportex.net\/blog\/en\/#website"},"datePublished":"2012-04-03T16:53:03+00:00","dateModified":"2019-05-10T14:41:50+00:00","author":{"@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251"},"description":"How to install elasticsearch on Centos. elasticsearch config Centos. elasticsearch setup Centos","breadcrumb":{"@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/supportex.net\/blog\/2012\/04\/elasticsearch-installation-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/supportex.net\/blog\/en\/"},{"@type":"ListItem","position":2,"name":"elasticsearch: installation and configuration on Centos 6.2"}]},{"@type":"WebSite","@id":"https:\/\/supportex.net\/blog\/en\/#website","url":"https:\/\/supportex.net\/blog\/en\/","name":"Supportex.NET blog","description":"Server and network management company","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/supportex.net\/blog\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/0690c26a0266603129fc15eae6243251","name":"Oleksii Tykhonov","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/supportex.net\/blog\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4fd5f58002717075c88963469b9babef?s=96&d=mm&r=g","caption":"Oleksii Tykhonov"},"url":"https:\/\/supportex.net\/blog\/author\/oleksiitykhonov\/"}]}},"_links":{"self":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/comments?post=2722"}],"version-history":[{"count":8,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2722\/revisions"}],"predecessor-version":[{"id":3144,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/posts\/2722\/revisions\/3144"}],"wp:attachment":[{"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/media?parent=2722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/categories?post=2722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/supportex.net\/blog\/wp-json\/wp\/v2\/tags?post=2722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}