Author Topic: How to Install Elasticsearch on Ubunto 14.04  (Read 7608 times)

Offline Scott Anderson

  • Administrator
  • Newbie
  • *****
  • Posts: 5
  • Country: us
  • Karma: +0/-0
How to Install Elasticsearch on Ubunto 14.04
« on: April 28, 2016, 06:49:56 AM »
Introduction

Elasticsearch is an Open Source Search Server based on Lucene, A platform for RESTful search and analytics. It stores all of the logs, provide a scalable searching solution.It is java based with real time and it can scale to thousand of nodes immediately.



Update OS

Code: [Select]
root@forum:~# apt-get update

Software dependencies:

  • Oracle Java 8 or above.

Add java repo to ubuntu

Code: [Select]
root@forum:~# add-apt-repository ppa:webupd8team/java
Install Oracle-Java

Code: [Select]
root@forum:~# apt-get install oracle-java8-installer

Once its Install Check the java -version

Code: [Select]
root@forum:~# java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)


Add Elasticsearch repository

Download and Install Elasticsearch Public Signing Key

Code: [Select]
root@forum:~# wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK

Create the repolist for Elasticsearch

Code: [Select]
root@forum:~# echo "deb http://packages.elastic.co/elasticsearch/5.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-5.x.list
deb http://packages.elastic.co/elasticsearch/5.x/debian stable main

Install Elastic Search


Code: [Select]
root@forum:~# apt-get install elasticsearch
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  elasticsearch
0 upgraded, 1 newly installed, 0 to remove and 156 not upgraded.
Need to get 26.9 MB of archives.
After this operation, 30.0 MB of additional disk space will be used.
Get:1 http://packages.elastic.co/elasticsearch/5.x/debian/ stable/main elasticsearch all 5.0.0~alpha1 [26.9 MB]
Fetched 26.9 MB in 2s (9323 kB/s)
Selecting previously unselected package elasticsearch.
(Reading database ... 26880 files and directories currently installed.)
Preparing to unpack .../elasticsearch_5.0.0~alpha1_all.deb ...
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Unpacking elasticsearch (5.0.0~alpha1) ...
Setting up elasticsearch (5.0.0~alpha1) ...


Enable Elasticsearch to start automatically at bootup

Code: [Select]
root@forum:~# update-rc.d elasticsearch defaults 95 10
 Adding system startup for /etc/init.d/elasticsearch ...
   /etc/rc0.d/K10elasticsearch -> ../init.d/elasticsearch
   /etc/rc1.d/K10elasticsearch -> ../init.d/elasticsearch
   /etc/rc6.d/K10elasticsearch -> ../init.d/elasticsearch
   /etc/rc2.d/S95elasticsearch -> ../init.d/elasticsearch
   /etc/rc3.d/S95elasticsearch -> ../init.d/elasticsearch
   /etc/rc4.d/S95elasticsearch -> ../init.d/elasticsearch
   /etc/rc5.d/S95elasticsearch -> ../init.d/elasticsearch


Open  Elasticsearch Configuration file and edit as per requirement

Search for network.host and replace  to network.host: localhost


Code: [Select]
root@forum:~# vi /etc/elasticsearch/elasticsearch.yml
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
# cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
# node.name: node-1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
# network.host: localhost
#
# Set a custom port for HTTP:
#
# http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]

Restart elasticsearch services

Code: [Select]
root@forum:~# /etc/init.d/elasticsearch restart

Finally, test your Elastcsearch is working properly or not!

Code: [Select]
root@forum:~# curl -X GET 'http://localhost:9200'
{
  "name" : "Mephisto",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "5.0.0-alpha1",
    "build_hash" : "7d4ed5b",
    "build_date" : "2016-04-04T10:39:25.841Z",
    "build_snapshot" : false,
    "lucene_version" : "6.0.0"
  },
  "tagline" : "You Know, for Search"
}


Thanks,
Scott




Hostripples - Affordable web hosting
https://hostripples.com
https://hostripples.in
https://hostripples.co.uk
Hostripples.com $1 Unlimited Hosting