How To Install Elasticsearch on an Ubuntu 14.04

3 years ago
Posted by andri
Board Tutorial
526 views


Elasticsearch is a platform for distributed, RESTful search and analysis. It can scale as needed, and you can get started using it right away on a single DigitalOcean droplet. In this tutorial, we will download, install, and start using Elasticsearch on Ubuntu.

Dependencies First, update the list of available packages by running :
sudo apt-get update

Next, we must install the Java runtime :
sudo apt-get install openjdk-7-jre-headless -y


Installing from the Debian software package

The best package to download for Ubuntu is the deb package. The RPM can work but it needs to be converted first, and we will not cover doing so here. Grab the deb package by running :
wget download.elasticsearch.org

Installing directly from a Debian package is done by running :
dpkg -i elasticsearch-1.5.2.deb

This results in Elasticsearch being properly installed in /usr/share/elasticsearch. Recall that installing from the Debian package also installs an init script in /etc/init.d/elasticsearch that starts the Elasticsearch server running on boot. The server will also be immediately started after installation.


Remove Elasticsearch Public Access

Before continuing, you will want to configure Elasticsearch so it is not accessible to the public Internet--Elasticsearch has no built-in security and can be controlled by anyone who can access the HTTP API. This can be done by editing elasticsearch.yml. Assuming you installed with the package, open the configuration with this command:
sudo vi /etc/elasticsearch/elasticsearch.yml


Then find the line that specifies network.bind_host, then uncomment it and change the value to localhost so it looks like the following:
network.bind_host: localhost


Then insert the following line somewhere in the file, to disable dynamic scripts:
script.disable_dynamic: true


Save and exit. Now restart Elasticsearch to put the changes into effect:
sudo service elasticsearch restart


Test your Elasticsearch install

Ensure the server is started by running
curl -X GET 'http://localhost:9200'

You should see the following response
{
"status" : 200,
"name" : "Hero for Hire",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.5.2",
"build_hash" : "62ff9868b4c8a0c45860bebb259e21980778ab1c",
"build_timestamp" : "2015-04-27T09:21:06Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"

}

Source :
www.digitalocean.comand gist.github.com