Google Cloud Compute Engine

How to Install Elasticsearch and Kibana on Ubuntu 18.04 | Google Cloud

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to Install Elasticsearch and Kibana on Ubuntu 18.04 on Google Cloud Platform.

Elasticsearch is a RESTful search engine which stores all collected data.

Kibana is a web interface for visualizing the data stored in Elasticsearch.

In this guide you are going to learn how to install and set up Elasticsearch on Ubuntu 18.04 LTS on Google Compute Engine, install Kibana and configure it with Nginx to visualize the data stored in Elasticsearch through your domain name.


Install Elasticsearch

Once you have your Compute Engine set up with Ubuntu 18.04, Nginx and your domain is pointed to your VM Instance, you are ready to install and configure Elasticsearch.

wget -qO - | sudo apt-key add -
echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt update
sudo apt install elasticsearch

Once Elasticsearch is installed you can restrict port 9200 from outside access by editing the elasticsearch.yml file and uncomment the and replace the value with locahost.

sudo nano /etc/elasticsearch/elasticsearch.yml 

So it looks looks like this.. localhost

Hit Ctrl+X followed by Y and Enter to save the file and exit.

Now start and enable Elasticsearch on server boot.

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

Now make sure your Elasticsearch service is running.

sudo systemctl status elasticsearch

Test your installation by sending a HTTP request.

curl -X GET "localhost:9200"

You will get a response with name, cluster_name, cluster_uuid, version.

Now Elasticsearch is installed and running successfully, next we can install Kibana.

Install Kibana

sudo apt install kibana

Once Kibana is installed you can enable and start Kibana.

sudo systemctl enable kibana
sudo systemctl start kibana

As Kibana listens only on localhost port 5601, you need to setup Nginx reverse proxy to allow access through your Domain name.

Set up Nginx Reverse Proxy for Kibana

Create a new Nginx server block.

sudo nano /etc/nginx/sites-available/

Paste the following:

server {
listen 80;
location / {
rewrite ^/(.*) /$1 break;
proxy_ignore_client_abort on;
proxy_pass http://localhost:5601;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;

Hit Ctrl+X followed by Y and Enter to save the file and exit.

Validate your Nginx configuration and restart it.

sudo nginx -t
sudo service nginx restart

Now Kibana dashboard is accessible via

Now Elasticsearch is configured and Kibana dashboard is set up using Nginx reverse proxy.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.