Our Work

How To Install ElasticSearch On Windows, Ubuntu and CentOS/RHEL

Posted 1 year, 7 months and 4 days ago

Pre- Requisites :-

Before installation, we have to setup java latest version 7u79 from oracle.

Care must be taken to have installation of oracle java only in the server. In other words,  don’t install two java’s on same machine like openJDK and oracle jdk.

Download Link :

The latest version of Elasticsearch can be downloaded from the following link for any platform.

       https://www.elastic.co/downloads/elasticsearch

Installing ElasticSearch on Windows :

Note : For windows we need compatible jdk 7 and install it by double clicking on .exe file

Below steps will come in handy for the installation.

Step 1 :

Download windows .zip from elastic site.

 Step 2:  

Unzip it.The following is the directory layout of elasticsearch.

   Before starting elastic server :

Step3:

Now start server by double click on the elasticsearch.bat file.    

Note : But this is normal start, as when we close the command prompt it will shoot the es server down automatically. That means we need to run it as a service on windows

Step 4 :

​c:\elasticsearch-{version}bin>service install
Installing service    :  "elasticsearch-service-x64"
Using JAVA_HOME (64-bit):  "c:\jvm\jdk1.7"
The service 'elasticsearch-service-x64' has been installed.

Step 5 :  ​

Then enter the following command to start elasticsearch backend as service.

C:\phani\elasticsearch-1.6.0\bin>service.bat start

The service 'elasticsearch-service-x64' has been started.

Step6 :

Go to browser and check    or :9200 then it is return status 200 on browser like following.

Installing ElasticSearch on Ubuntu :

Java Installation : oracle jdk for ubuntu.

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
java -version

set JAVA_HOME path in “/etc/profile” as

export JAVA_HOME=’/usr/java/jdk1.7.0_55’

Step1 :

Download .deb package from the following url.

https://www.elastic.co/downloads/elasticsearch

Step 2 :  

 Login as root user and install .deb package

            dpkg -i elasticsearch-1.6.0.deb 

         The es got installed in your server now; change the configuration file elasticsearch.yml according to your needs.

Note: Make sure that before starting elasticsearch server you change the configurations.

Step 3 :  ​

Now operate following commands

To add services.

sudo update-rc.d elasticsearch defaults 95 10

start elastic serve r:
sudo /etc/init.d/elasticsearch start

Step 4 :  

Verify by typing localhost:9200 in browser.

It should return response 200 and if it appears then our installations is success.       

Installing ElasticSearch on CentOS/RHEL :

For centos/RHEL directly we can use yum  install oracle-java7-installer

Then it will install java on server

set the JAVA_HOME path on “/etc/profile”.

Step 1:

Download .rpm package from url : https://www.elastic.co/downloads/elasticsearch

Step 2 :

Use rpm -ivh elasticsearch.rpm

This will install elasticsearch.

Step 3 :​

Add elasticsearch process to chkconfig like following

sudo /sbin/chkconfig --add elasticsearch

Step 4 : 

Change the configurations we required in elasticsearch.yml file and start elastic search using following command.

sudo service elasticsearch start

Step 5 :

Check elasticsearch running or not by typing localhost/ip:9200 in browser it should return 200 response from server.

RHEL/Cent OS file locations on server :

ES_HOME=/usr/share/elasticsearch

LOG_DIR=/var/log/elasticsearch

DATA_DIR=/var/lib/elasticsearch

WORK_DIR=/tmp/elasticsearch

CONF_DIR=/etc/elasticsearch

CONF_FILE=/etc/elasticsearch/elasticsearch.yml

Ubuntu/Debian file locations :

ES_HOME=/usr/share/elasticsearch

LOG_DIR=/var/log/elasticsearch

DATA_DIR=/var/lib/elasticsearch

WORK_DIR=/tmp/elasticsearch

CONF_DIR=/etc/default/elasticseach

CONF_FILE=/etc/elasticsearch/elasticsearch.yml

Related Posts