How to Install latest version[6.3] of Elasticsearch and kibana on ubuntu

By: Sunil Kumar |  In: Server  |  Last Updated: 2018/09/03

Elasticsearch is one of the most popular and powerful search engine written in Java and based on Lucene algorithm. Elasticsearch can be used as a stand-alone search engine for your web application.
Elasticsearch is developed alongside a data-collection and log-parsing engine called Logstash, and an analytics and visualization platform called Kibana. The three products are designed for use as an integrated solution, referred to as the “Elastic Stack”.
Elasticsearch can be used to search all kinds of documents. It provides scalable search, has near real-time search, and supports multi-tenancy.
“Elasticsearch is distributed, which means that indices can be divided into shards and each shard can have zero or more replicas. Each node hosts one or more shards and acts as a coordinator to delegate operations to the correct shard(s). Rebalancing and routing are done automatically”. Related data is often stored in the same index, which consists of one or more primary shards, and zero or more replica shards. Once an index has been created, the number of primary shards cannot be changed.
In this article, we will learn how to install and configure Elasticsearch, kibana and how to use kibana to store and retrieve data.

Install Java

As Elasticsearch is based on Java platform we need to install java on our machine. To install the latest version of Java-update your system with

sudo apt-get update
sudo apt-get install default-jdk

The minimum version of Java required by Elasticsearch is 1.8.
If you are using the latest version of Ubuntu the latest version will be installed into your system. If you are using an older version of Ubuntu you can refer this link to install java1.8 into your system.
It will install the latest version of the Java in your system.

Install Elasticsearch

Elasticsearch 6.3 is released recently and is the latest version of the Elasticsearch and we will be installing that.

NOTE: you can install any version of Elasticsearch by changing the version number in all the commands but we highly recommend to install the latest version as it has some massive changes compared to the old version.

cd /tmp
mkdir Elasticsearch;
cd Elasticsearch

now the .deb file will be download to your /etc/Elasticsearch directory
After downloading the package we can install this package using

sudo dpkg -i Elasticsearch-6.3.0.deb

Configure and Run Elasticsearch

After installing Elasticsearch successfully we have to configure this to run on our system.
Elasticsearch has an .yml configuration file
open that configuration file

sudo nano /etc/Elasticsearch/Elasticsearch.yml

and uncomment the below line by removing # from the beginning

and then change the IP to localhost as shown below: localhost

and restart the Elasticsearch

sudo service elastisearch restart

Now elastic search is configured to get it used

curl -XGET "http://localhost:9200"
    "name" : "j1kpAoc",
    "cluster_name" : "Elasticsearch",
    "cluster_uuid" : "hvwHyjK5Sq6SCkfrKTDnlQ",
    "version" : {
       "number" : "6.3.0",
       "build_flavor" : "default",
       "build_type" : "deb",
       "build_hash" : "424e937",
       "build_date" : "2018-06-11T23:38:03.357887Z",
       "build_snapshot" : false,
       "lucene_version" : "7.3.1",
       "minimum_wire_compatibility_version" : "5.6.0",
       "minimum_index_compatibility_version" : "5.0.0"
    "tagline" : "You Know, for Search"

Install Kibana

If you have worked on MySQL database you use phpmyadmin as the front end to your MySQL database to execute queries and do other operation on the MySQL database.
On the same way, Kibana is used as the front end to the Elasticsearch.
to install Kibana on your system

sudo dpkg -i kibana-6.3.0-amd64.deb

Configure and Run Kibana

Once we are done with install kibana we can configure it to work with Elasticsearch on our system
open the configuration file

sudo nano /etc/kibana/kibana.yml

and uncomment the following lines


Now enable and restart kibana

sudo systemctl enable kibana
sudo systemctl start kibana

Once you are done with this process, you can open Kibana in your web browser


That’s it. You have now successfully installed Kibana and Elasticsearch.

Basic usages

We can use the Dev Tools utility to do the operation like creating an index, fetching data, inserting data on Elasticsearch.
When you calick Dev Tools you will see a console like this where you can write Elasticsearch queries.

Create an Index

As in MySQL data is stored in tables, in Elasticsearch data are stored in indexes. Before storing data to the indexes we hhave to ctreate an index. we can use PUT request to create an index

    "settings": {
       "number_of_shards": 3

this command will create an index named INDEX_NAME.
So when we create an index with name “books”

PUT books
    "settings": {
       "number_of_shards": 3

Insert some data to index

We will be using the POST calls to insert data to index. The data to be inserted is in the form of JSON

POST books/course
   "name":"Learn Elasticsearch",
   "type": "computer"

Fetching data from Index

We can fetch the data from Elasticsearch as well.

GET books/_search


Elasticsearch is very simple to setup and use. Now you will be able to install, configure and use Elasticsearch easily on your server.


Leave a Comment

Your email address will not be published.


Sunil Kumar

I am the owner of acmeextension. I am a passionate writter and reader. I like writting technical stuff and simplifying complex stuff.
Know More

Join more than 10,000 others Web Developers