{"id":1533,"date":"2021-01-22T13:00:49","date_gmt":"2021-01-22T13:00:49","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/install-elasticsearch-on-google-cloud\/"},"modified":"2025-07-23T09:47:37","modified_gmt":"2025-07-23T04:17:37","slug":"install-elasticsearch-on-google-cloud","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/install-elasticsearch-on-google-cloud\/","title":{"rendered":"How to Install Elasticsearch on Google Cloud"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Together, Google Cloud and Elastic share a vision of meeting customers where they are on their journey to the cloud. Our partnership has been inspired by our joint customers who are looking for choice, security, a platform for innovation and integrations that helps them get better insights from their data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u2013 Thomas Kurian, CEO, Google Cloud<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post is all about how to&nbsp;<strong>install Elasticsearch on Google Cloud<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Elasticsearch (ES) is an open-source, broadly-distributable, readily-scalable, analytics, enterprise-grade search engine including textual, numerical, geospatial, structured, and unstructured.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Elasticsearch can power extremely fast searches that support your data discovery applications and accessible through an extensive and elaborate API.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to its speed, scalability, and resiliency, Elasticsearch has several powerful built-in features that make storing and searching data even more efficient. Also being a store admin you can&nbsp;<a href=\"https:\/\/meetanshi.com\/blog\/configure-magento-2-elasticsearch\/\">configure Magento 2 Elasticsearch<\/a>&nbsp;to use its features like open source, analytics, readily scalable, etc.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Wherever you are in your cloud journey, Google Cloud gives you the ability to turn data into actionable intelligence so you can make better-informed business decisions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Install Elasticsearch on Google Cloud:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First of all, you need to set up your Google Cloud account.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once you have created an account, you need to get familiarized with it.<br><br>After login into your Google cloud, create a project in&nbsp;<strong>Dashboard<\/strong>.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-1-1024x493.png\" alt=\"elastic 1\" class=\"wp-image-12606\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Search \u201cVM\u201d from the search box and click on \u201cVM instances\u201d.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-2-1024x493.png\" alt=\"elastic 2\" class=\"wp-image-12607\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create VM instances by clicking on the \u201cCreate\u201d button.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-3-1024x492.png\" alt=\"elastic 3\" class=\"wp-image-12609\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a new VM instance by giving the name, allow HTTP traffic and HTTPS traffic then click on the \u201cCreate\u201d button.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-4-1024x729.png\" alt=\"elastic 4\" class=\"wp-image-12610\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can see the created VM instance with the given name and select the \u2018<strong>SSH<\/strong>\u2018 from the \u2018<strong>Connect<\/strong>\u2018 column of VM instances.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-6-1024x486.png\" alt=\"elastic 6\" class=\"wp-image-12611\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update the package index using below command and before continuing with the installation.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt update<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-7-1.png\" alt=\"elastic 7\" class=\"wp-image-12615\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Allow access to your repositories via HTTPS.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install apt-transport-https<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-9.png\" alt=\"elastic 9\" class=\"wp-image-12617\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Update the GPG key for the Elasticsearch repository.<\/li>\n<\/ul>\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<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-11-1024x643.png\" alt=\"elastic 11\" class=\"wp-image-12620\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add the repository to your system.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb 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<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-12-1024x188.png\" alt=\"elastic 12\" class=\"wp-image-12621\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Install<\/strong>&nbsp;elasticsearch using below command<strong>.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install elasticsearch<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-13-1024x228.png\" alt=\"elastic 13\" class=\"wp-image-12622\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Elasticsearch does not run until you start it after finishing the installation. When you reboot the machine, you need to rerun the Elasticsearch service as it does not start automatically.<\/li>\n\n\n\n<li>If you want to reload the elasticsearch when the system restarts, use the below commands:<\/li>\n\n\n\n<li>To have elasticsearch automatically, reload when the system restarts, use the following commands:<\/li>\n\n\n\n<li>First, reload the system configuration:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl daemon-reload<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-16.png\" alt=\"elastic 16\" class=\"wp-image-12624\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Enable the elasticsearch service<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl enable elasticsearch.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To change the status of service, use the below command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>start : sudo systemctl start elasticsearch.service<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>stop : sudo systemctl stop elasticsearch.service<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>restart : sudo systemctl restart elasticsearch.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the status of the service once you finish the above steps.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>status : sudo systemctl status elasticsearch.service<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/17-1024x339.png\" alt=\"17\" class=\"wp-image-12627\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The default configuration does not allow your machine to be accessed by other hosts. To allow remote access, use a text editor of your choice and open the elasticsearch.yml file.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Give permission:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo chmod -R 777 \/etc\/elasticsearch\/elasticsearch.yml<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-18-1024x303.png\" alt=\"elastic 18\" class=\"wp-image-12625\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo vim \/etc\/elasticsearch\/elasticsearch.yml<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then press \u201cInsert\u201d key from your keyboard and pass your own port to \u2018network.host\u2019.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-19.png\" alt=\"elastic 19\" class=\"wp-image-12626\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use UFW firewall to Secure Elasticsearch (Not Necessary).<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Uncomplicated Firewall (UFW) is built into Linux and disabled by default. Before enabling UFW, add the necessary rules.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Write the below command in the terminal,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt-get install ufw<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-20.png\" alt=\"elastic 20\" class=\"wp-image-12628\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">You need to allow access on port 22 for remote access over SSH or the custom port if you changed the default SSH.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow 22<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-21.png\" alt=\"elastic 21\" class=\"wp-image-12631\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Elasticsearch listens to that port for incoming requests. Therefore,&nbsp;you have to&nbsp;<strong>allow access on port 9200<\/strong>&nbsp;for your remote machine.&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow from network.host ip to any port 9200<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/Screenshot-at-January-8th-2021-12.48.42-pm.jpg\" alt=\"sudo 92\" class=\"wp-image-12661\"\/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The Elasticsearch service is active, the machine can be accessed remotely, and you already enabled UFW, if the tool works, you can use curl to test.<\/li>\n\n\n\n<li>The default port for Elasticsearch is 9200. So, you can send an HTTP request on the localhost and see if you get a response.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>curl localhost:9200<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2021\/01\/elastic-23.png\" alt=\"elastic 23\" class=\"wp-image-12632\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">It may seem a bit lengthy but is simple to implement.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Do you have a question after the installation of elasticsearch?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Yes, I do\u2026 How can I use installed Elasticsearch on my Magento 2?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Visit here to&nbsp;<a href=\"https:\/\/experienceleague.adobe.com\/en\/docs\/commerce-operations\/configuration-guide\/overview\" target=\"_blank\" rel=\"noreferrer noopener\">configure Magento to use Elasticsearch<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can also refer to the video tutorial to Install Elasticsearch on Google Cloud from our&nbsp;<a href=\"https:\/\/www.youtube.com\/playlist?list=PLBTOxSAJzwEjM5MilmEqj98Ib80tKBu7r\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 video tutorial<\/a>&nbsp;series:<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"How to Setup Separate Theme for Desktop and Mobile in Magento 2\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/9SisV30XDRw?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do share the post with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Together, Google Cloud and Elastic share a vision of meeting customers where they are on their journey to the cloud. Our partnership has been inspired&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34,112],"tags":[],"class_list":["post-1533","post","type-post","status-publish","format-standard","hentry","category-magento","category-e-commerce"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1533","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1533"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1533\/revisions"}],"predecessor-version":[{"id":19097,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1533\/revisions\/19097"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1533"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1533"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1533"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}