Installing ElasticSearch

This post covers the installation of ElasticSearch on a single node. Look at my next post to see how to add some more nodes to form a cluster. The post was written before Elasticsearch 5.x was released so it only refers to version 2.x. This post covers the installation of version 5.0 (in a little less detail).

Elasticsearch have many useful plugins, most of them I do not even know. Here I install some plugins that I used and liked, I guess everyone has his/her favorites that may vary from my own.

Let’s start:

As always, I will be using my favorite Linux flavor, CentOS 6.7. There is a simple zip installation, but this time I will use RPM’s and YUM for the installation.

First, we need to prepare the OS for Elasticsearch.


Getting Linux ready for Elasticsearch installation

  1. add “export ES_HEAP_SIZE=4g” to your .bash_profile or .profile file.
    This sets the JAVA heap size available for Elasticsearch. Set it to about half the available memory on the server. Never set it higher than 32Gb.
  2. edit /etc/sysctl.conf
    add those parameter (or change them if they already exist):

    file-max = 65536

    Those setting increase the number of file descriptors and mmap counts and disable OS swapping. You can find more information here.

  3. Then, in order for the changes to take effect, run:
    sysctl -p


Now, the installation itself

First, we have to get the PGP key:

rpm --import

And then add the elasticSearch yum repository:

echo "[elasticsearch-2.x]

name=Elasticsearch repository for 2.x packages




enabled=1" >> /etc/yum.repos.d/elasticsearch.repo

Now we can install elasticsearch itself:

yum install elasticsearch

This will install elsticsearh as a service.

To make the elasticsearch service start automatically on system startup execute:

chkconfig --add elasticsearch

I want to install some plugins, but first I need to know where the elasticsearch binaries are. A quick look in the /etc/init.d/elasticsearch file show that the installation is located at /usr/share/elasticsearch, so I added this path plus it’s bin directory to $PATH:

export PATH=$PATH:/usr/share/elasticsearch/bin

By default, ElasticSearch binds itself to localhost, we want to change it if we will be accessing this server remotely. So we have to edit ElasticSearch configuration file which is


Search for the “” section and change the Ip address to the network address of the server (also remember to uncomment the line).

Now I can install my plugins. First let’s install license:

[[email protected] elasticsearch]# plugin install license

-> Installing license...

Trying ...

Downloading .......DONE

Verifying checksums if available ...

Downloading .DONE

Installed license into /usr/share/elasticsearch/plugins/license


Now we can install ElasticSearch’s visualization tool, Kibana, along with some of its plugins. Kibana is not free and is available for a limited trial period unless you purchase a license, so installing it is optional.

Download the Kibana rpm (current version is 4.5) from here and install it:

rpm -i kibana-4.5.0-1.x86_64.rpm

This will install kibana into /opt/kibana and configure it as a service. Add the kibana bin directory to PATH:

export PATH=$PATH:/opt/kibana/bin

And make kibana start automatically:

chkconfig --add kibana

If kibana fails to start automatically, check the log and make sure that the file /opt/kibana/optimize/.babelcache.json is owned by user kibana.

Now edit the kibana config file /opt/kibana/config/kibana.yml and change those variables with the actual host name of your elasticsearch and kibana installations. The default port that Elasticsearch listens on is 9200, so the url should be http://<host>:9200.

Next, we will install Marvel, a visual monitoring tool for ElasticSearch. We need to install Marvel agent on every node in our cluster, and Marvel plugin only on the nodes we want to function as Marvel server.

First the agent:

[[email protected] ~]# plugin install marvel-agent
-> Installing marvel-agent...
Trying ...
Downloading ..........DONE
Verifying checksums if available ...
Downloading .DONE
@ WARNING: plugin requires additional permissions @
* java.lang.RuntimePermission setFactory
* setHostnameVerifier
for descriptions of what these permissions allow and the associated risks.

Continue with installation? [y/N]Y
Installed marvel-agent into /usr/share/elasticsearch/plugins/marvel-agent

Then the server:

[[email protected] ~]# kibana plugin --install elasticsearch/marvel/latest
Installing marvel
Attempting to transfer from
Transferring 1576917 bytes....................
Transfer complete
Extracting plugin archive
Extraction complete
Optimizing and caching browser bundles...
Plugin installation complete

And finally we will install Sense, which is a kibana plugin that enables a simple web interface for running ElasticSearch commands:

[[email protected] ~]# kibana plugin --install elastic/sense
Installing sense
Attempting to transfer from
Transferring 1352402 bytes....................
Transfer complete
Extracting plugin archive
Extraction complete
Optimizing and caching browser bundles...
Plugin installation complete

Now we will restart ElasticSearch and kibana and see that everything works. You can restart the individual services or just restart the whole machine and check that autostart works properly.

First of all, test that ElasticSearch is up by pointing your browser to the Server where you installed ElasticSearch at port 9200. It should return this json snippet with the “You know, for search” phrase:

  "name" : "Collector",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.1",
    "build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
    "build_timestamp" : "2016-04-04T12:25:05Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  "tagline" : "You Know, for Search"

Now we will check Kibana and it’s plugins. Point your browser at your server, port 5601. You should see this:

We will not configure Kibana any further in this post, so just ignore the “Configure an index pattern” message.

Now click the square tiles icon (in the red circle) to show the installed Kibana plugins:

If we clock on Marvel we can see its main screen. Marvel is a monitoring tool for ElasticSearch, It is very simple and dull now and the status is Yellow because we have only one node in our cluster. You can click on the node name to drill down and see some graphs:

And finally, we can go back and click on the Sense plugin. Here we have an easy to use graphical interface for ElasticSearch commands, an alternative to the basic http interface:

That’s it for the installation. There is some configuration that can and should be done, and we also did not cover using Kibana or Marvel. I will try to investigate it in later posts.

If you want to go on and create an Elasticsearch cluster, look at my next post.

A small update: A new version of Elasticsearch, 5.0, was released on October 2016, you can read about it and it’s installation process here.

This entry was posted in ElasticSearch and tagged , , . Bookmark the permalink.

Leave a Reply