{"id":6886,"date":"2021-06-09T18:18:58","date_gmt":"2021-06-09T18:18:58","guid":{"rendered":"https:\/\/linuxways.net\/?p=6886"},"modified":"2021-06-09T18:18:58","modified_gmt":"2021-06-09T18:18:58","slug":"how-to-install-elasticsearch-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-elasticsearch-on-ubuntu-20-04\/","title":{"rendered":"How to Install Elasticsearch on Ubuntu 20.04"},"content":{"rendered":"<p>Elasticsearch is an analytic engine that allows you to search and analyze data in real-time. It is an open-source project distributed platform that provides RESTful API. You can host elasticsearch in your own data center or in a local machine and use it for storing, searching, and analyzing them.<\/p>\n<p>In this quick article, I am going to show you how to install the latest version of elasticsearch on Ubuntu 20.04 and configure it to use.<\/p>\n<h3>Installing elasticsearch<\/h3>\n<p>First, update your packages using the following command.<\/p>\n<pre># apt-get update<\/pre>\n<p>Install required dependency as below.<\/p>\n<pre># apt-get -y install curl gnupg2 apt-transport-https<\/pre>\n<p>Now, you need to add an elastic search GPG key in order to download the package. So, copy paste the following line of command in your terminal.<\/p>\n<pre># wget -qO - https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | apt-key add -<\/pre>\n<p>Now download the elastic search package using the following command. Here, if you use 7.x as below, you will get the latest version of the elastic search package. If you want an older version you can specify in place of 7.x. Please refer to the official release version documentation <a href=\"https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/es-release-notes.html\">https:\/\/www.elastic.co\/guide\/en\/elasticsearch\/reference\/current\/es-release-notes.html<\/a><\/p>\n<pre># sh -c 'echo \"deb https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" &gt; \/etc\/apt\/sources.list.d\/elastic-7.x.list'<\/pre>\n<p>You have just added an elastic search package to the system. So, let\u2019s update it once.<\/p>\n<pre># apt-get update<\/pre>\n<p>Now, you are ready to install elastic search just by entering the following command.<\/p>\n<pre># apt-get install elasticsearch -y<\/pre>\n<h3>Configuring elasticsearch<\/h3>\n<p>At this point, your elasticsearch service is installed. You need to configure it to reach your network or publicly. The configuration file is located inside \/etc\/elasticsearch\/elasticsearch.yml so, open it using your favorite editor.<\/p>\n<pre># vim \/etc\/elasticsearch\/elasticsearch.yml<\/pre>\n<p>Make sure you change the following parameter. Here, \u2018cluster.name\u2019 is the name for your elasticsearch service. In \u2018network.host\u2019 use your server IP address, otherwise, it will not be accessible outside the host. Similarly, use your host IP in \u2018discovery.seed_hosts\u2019 as below.<\/p>\n<pre>cluster.name: my_search_server\r\n\r\nnetwork.host: 10.4.3.201\r\n\r\ndiscovery.seed_hosts: 10.4.3.201<\/pre>\n<p>Save the file and start and enable an elasticsearch service using systemctl.<\/p>\n<pre># systemctl start elasticsearch\r\n\r\n# systemctl enable elasticsearch<\/pre>\n<p>Check service status using,<\/p>\n<pre># systemctl status elasticsearch<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"890\" height=\"296\" class=\"wp-image-6887\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-151.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-151.png 890w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-151-300x100.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-151-768x255.png 768w\" sizes=\"auto, (max-width: 890px) 100vw, 890px\" \/><\/p>\n<p>Now, port 9200 should be listening, you can verify using the following command.<\/p>\n<pre># ss -ltn | grep 9200<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"130\" class=\"wp-image-6888\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-152.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-152.png 696w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-152-300x56.png 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/p>\n<p>If everything is fine you should get the following output as the response.<\/p>\n<pre># curl -X GET \"localhost:9200\/\"<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"752\" height=\"332\" class=\"wp-image-6889\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-153.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-153.png 752w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/06\/word-image-153-300x132.png 300w\" sizes=\"auto, (max-width: 752px) 100vw, 752px\" \/><\/p>\n<h3>Conclusion<\/h3>\n<p>Now you can use the hosted elasticsearch server for doing searches. If your application generates a huge amount of data and the search procedures are slow, then using elasticsearch will be best. This article guides you to install elasticsearch in the stable version of Ubuntu 20.04. Hope it helped you a lot.<\/p>\n<p>&nbsp;<\/p>","protected":false},"excerpt":{"rendered":"<p>Elasticsearch is an analytic engine that allows you to search and analyze data in real-time. It is an open-source project distributed platform that provides RESTful API. You can&hellip;<\/p>","protected":false},"author":1,"featured_media":7123,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[358,100],"class_list":["post-6886","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-elasticsearch","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6886","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=6886"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/6886\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/7123"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=6886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=6886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=6886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}