{"id":12105,"date":"2024-04-01T17:29:15","date_gmt":"2024-04-01T11:59:15","guid":{"rendered":"https:\/\/www.skynats.com\/?p=12105"},"modified":"2025-01-08T20:36:53","modified_gmt":"2025-01-08T15:06:53","slug":"how-to-install-and-configure-elasticsearch-on-ubuntu-22-04","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/how-to-install-and-configure-elasticsearch-on-ubuntu-22-04\/","title":{"rendered":"How to Install and Configure Elasticsearch on Ubuntu 22.04"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-resized\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"509\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu-1024x509.png\" alt=\"Elasticsearch on Ubuntu 22.04\" class=\"wp-image-12129\" style=\"width:290px;height:auto\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu-1024x509.png 1024w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu-300x149.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu-768x382.png 768w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu-1200x597.png 1200w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/Elasticsearch.ubuntu.png 1400w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The Elasticsearch search and analytics engine is a highly scalable search and analytics tool that is compatible with open-source applications. The analysis of log and event data, full-text search, application performance monitoring, and business analytics are just some of the many applications that make use of it. It is also used for a wide range of additional purposes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-normal-font-size\" id=\"h-prerequisites\"><strong>Prerequisites<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before installing Elasticsearch on the Ubuntu server will require the following specifications<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Operating System and Version: Ubuntu 22.04<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Minimum CPU: 2 CPU cores<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Minimum RAM: 4 GB RAM<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Should have root or sudo access<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-normal-font-size\"><strong>Installation steps<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">1. Import the Elasticsearch public GPG key into APT using the curl command below.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/artifacts.elastic.co\/GPG-KEY-elasticsearch | sudo gpg --dearmor -o \/usr\/share\/keyrings\/elastic.gpg<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2. Next add the Elastic source list to the sources.list.d directory<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb &#91;signed-by=\/usr\/share\/keyrings\/elastic.gpg] https:\/\/artifacts.elastic.co\/packages\/7.x\/apt stable main\" | sudo tee -a \/etc\/apt\/sources.list.d\/elastic-7.x.list<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3. Update the package lists using below command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4. Then using apt install command, install it on the server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install elasticsearch<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5. After the installation,Configure the Elasticsearch<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To configure this edit the configuration file elasticsearch.yml located in the directory \/etc\/Elasticsearch using a text editor<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/elasticsearch\/elasticsearch.yml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The configuration file contains configuration settings such as cluster, node, paths, memory, and network. Elasticsearch listens on port 9200 by default, although it can be changed based on the requirements.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Then add the following lines in the configuration file. Instead of using localhost, you can specify an IP address to access<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cluster.name: my-application\r\nnode.name: node-1\r\nnetwork.host: localhost\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6. After configuring the configuration file start and enable the its service and check the status with systemctl command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start elasticsearch\r\nsudo systemctl enable elasticsearch\r\nsudo systemctl status elasticsearch\r<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output should be as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1024\" height=\"167\" sizes=\"(max-width: 1024px) 100vw, 1024px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1-1024x167.png\" alt=\"Install and Configure Elasticsearch \" class=\"wp-image-12111\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1-1024x167.png 1024w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1-300x49.png 300w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1-768x125.png 768w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1-1200x196.png 1200w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticstatus-1.png 1348w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">7. Use the following command to test whether it is working correctly on the server<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -X GET 'http:\/\/localhost:9200'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Output should be as shown below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"695\" height=\"325\" sizes=\"(max-width: 695px) 100vw, 695px\" src=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticresult-2.png\" alt=\"Install and Configure Elasticsearch on Ubuntu 22.04\" class=\"wp-image-12112\" srcset=\"https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticresult-2.png 695w, https:\/\/www.skynats.com\/blog\/wp-content\/uploads\/2024\/04\/elasticresult-2-300x140.png 300w\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">This will be configured and is working, as shown in the above output.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you run into any issues or hiccups throughout to Install and Configure Elasticsearch on Ubuntu 22.04 <a href=\"https:\/\/ubuntu.com\/blog\/tag\/ubuntu-22-04\" target=\"_blank\" rel=\"noopener\">,<\/a> our\u00a0<a href=\"https:\/\/www.skynats.com\/blog\/\">Support Team<\/a>\u00a0members are here to help.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Elasticsearch search and analytics engine is a highly scalable search and analytics tool that is compatible with open-source applications. The analysis of log and event data, full-text search, application performance monitoring, and business analytics are just some of the many applications that make use of it. It is also used for a wide range [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837,5,762],"tags":[836,839,838,828],"class_list":["post-12105","post","type-post","status-publish","format-standard","hentry","category-elasticsearch","category-blog","category-ubuntu-22-04","tag-elasticsearch","tag-java","tag-search-engine","tag-ubuntu-22-04"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12105","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=12105"}],"version-history":[{"count":0,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/12105\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=12105"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=12105"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=12105"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}