elasticsearch

Install Elasticsearch on Ubuntu

Recently i wish to practice elasticsearch with a laravel project.That’s why i studied few about elasticsearch and tried to learn how to install elasticsearch and wrote a blog.In this article we learn how to install elasticsearch on homestead or ubuntu.But first we need to know what is elasticsearch.On previous i wrote a blog about that,you can read this elasticsearch.Here is few little steps,which helps you to install elasticsearch.

Install Java

Elasticsearch developed by java,so first we need to install java

sudo apt-get install openjdk-7-jre-headless -y

Download and install Elasticsearch Public Signing Key

sudo wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

Add repository

sudo echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list

Update Aptitude

sudo apt-get update

Install Elasticsearch

sudo apt-get install elasticsearch

Set Elasticsearch to run on startup

update-rc.d elasticsearch defaults 95 10

Start Elasticsearch server

/etc/init.d/elasticsearch start

Test whether it’s working

curl -X GET localhost:9200

after that you got a json following below

{
  "name" : "Wild Child",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "WMoHqGuaSymDnkbJ2JNvvg",
  "version" : {
    "number" : "2.4.1",
    "build_hash" : "c67dc32e24162035d18d6fe1e952c4cbcbe79d16",
    "build_timestamp" : "2016-09-27T18:57:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.2"
  },
  "tagline" : "You Know, for Search"
}

After that you can change port or other configuration in elasticsearch,for that you have to edit elasticsearch.yml file which has in

/etc/elasticsearch

directory