How to install Elasticsearch in Ubuntu and Windows

0
4048
3 min read
This article is an extract from the book, Mastering Elastic Stack  co-authored by Ravi Kumar Gupta and Yuvraj Gupta.This book will brush you up with basic knowledge on implementing the Elastic Stack and then dives deep into complex and advanced implementations.

In today’s tutorial we aim to learn Elasticsearch v5.1.1 installation for Ubuntu and Windows.

Installation of Elasticsearch on Ubuntu 14.04

In order to install Elasticsearch on Ubuntu, refer to the following steps:

  1. Download Elasticsearch 5.1.1 as a debian package using terminal:

wget https://artifacts.elastic.co

/downloads/elasticsearch/elasticsearch-5.1.1.deb


2. Install the debian package using following command:

sudo dpkg -i elasticsearch-5.1.1.deb

Elasticsearch will be installed in /usr/share/elasticsearch directory. The configuration files will be present at /etc/elasticsearch. The init script will be present at /etc/init.d/elasticsearch. The log files will be present within /var/log/elasticsearch directory.

3. Configure Elasticsearch to run automatically on bootup . If you are using SysV init distribution, then run the following command:

sudo update-rc.d elasticsearch defaults 95 10

The preceding command will print on screen:

Adding system startup for, /etc/init.d/elasticsearch

Check status of Elasticsearch using following command:

sudo service elasticsearch status

Run Elasticsearch as a service using following command:

sudo service elasticsearch start

Elasticsearch may not start if you have any plugin installed which is not supported in ES-5.0.x version onwards. As plugins have been deprecated, it is required to uninstall any plugin if exists in prior version of ES. Remove a plugin after going to ES Home using following command: bin/elasticsearch-plugin remove head Usage of Elasticsearch command:

sudo service elasticsearch {start|stop|restart|force- reload|status}

If you are using systemd distribution, then run following command:

sudo /bin/systemctl daemon-reload

sudo /bin/systemctl enable elasticsearch.service

To verify elasticsearch installation open open http://localhost:9200 in browser or run the following command from command line:

curl -X GET http://localhost:9200

Installation of Elasticsearch

Installation of Elasticsearch on Windows

In order to install Elasticsearch on Windows, refer to the following steps:

  1. Download Elasticsearch 5.1.1 version from its site using the following link:

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

-5.1.1.zip

Upon opening the link, click on it and it will download the ZIP package.

2. Extract the downloaded ZIP package by unzipping it using WinRAR, 7-Zip, and other such extracting softwares (if you don’t have one of these then download it).

This will extract the files and folders in the directory.

3. Then click on the extracted folder and navigate the folder to reach inside the bin folder.

4. Click on the elasticsearch.bat file to run Elasticsearch.

If this window is closed Elasticsearch will stop running, as the node will shut down.

5. To verify Elasticsearch installation, open http://localhost:9200 in the browser:

Installation of Elasticsearch

Installation of Elasticsearch as a service

After installing Elasticsearch as previously mentioned, open Command Prompt after navigating to the bin folder and use the following command:

elasticsearch-service.bat install

Usage: elasticsearch-service.bat install | remove | start | stop | manager

To summarize, we learnt installation of Elasticsearch on Ubuntu and Windows. If you are keen to know more about how to work with the Elastic Stack in a production environment, you can grab our comprehensive guide Mastering Elastic Stack.

Mastering Elastic Stack

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here