November 9, 2016 · Setup Guides Elasticsearch

Install Elasticsearch on Ubuntu 14.04

Installing Elasticsearch is pretty straightforward on Ubuntu 14.04. Here's a brief guide on how to do so:

Step 1 - Install Java 8

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

Set Java 8 as your default Java version

sudo update-alternatives --query java

it should show something like this:

There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1081      auto mode
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      manual mode
* 2            /usr/lib/jvm/java-8-oracle/jre/bin/java          1081      manual mode

Select java-8-oracle then press enter!

Step 2 - Install Elasticsearch

A Debian package for Elasticsearch is available for Ubuntu. Just download and run as follows:

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.0.0.deb
sudo dpkg -i elasticsearch-5.0.0.deb
sudo update-rc.d elasticsearch defaults

Test it out:

curl http://localhost:9200/

You should see:

{
  "name" : "bn_rdiv",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "ii1f0w8SS4epIJkZyOPJJw",
  "version" : {
    "number" : "5.0.0",
    "build_hash" : "253032b",
    "build_date" : "2016-10-26T04:37:51.531Z",
    "build_snapshot" : false,
    "lucene_version" : "6.2.0"
  },
  "tagline" : "You Know, for Search"
}

Step 3 - Configure

Elasticsearch is actually designed to work out of the box without any manual configuration. However, if you intend to do some additional tweaking, a config file can be found on /etc/elasticsearch/elasticsearch.

Conclusion

We should now have a running Elasticsearch instance listening on Port :9200. I suggest you check out the Official Docs on creating and searching documents.