Saturday, 5 March 2011

Installing ElasticSearch on mac os x or linux

These instructions are specifically for Mac Os X , but they should work fine on linux too.

Download the latest version of Elastic search from here: The current version is 0.18.5 but a later version should be ok

Unpack the tar file in the download directory (doubleclick on the tar file) this should create the directory ~/Downloads/elasticsearch-0.18.5

open a console in the download directory and pull down the elastic search service wrapper from github.

$cd ~/Downloads
$git clone elasticsearch-servicewrapper

Now we will move the service into place

$cd ~/Downloads
$sudo mv elasticsearch-0.18.5 /usr/local/share
$cd elasticsearch-servicewrapper
$sudo mv service /usr/local/share/elasticsearch-0.18.5/bin
$cd /usr/local/share
$sudo ln -s elasticsearch-0.18.5 elasticsearch
$sudo chown -R root:wheel elasticsearch

Now we can start up the service

$cd /usr/local/share/elasticsearch
$sudo bin/service/elasticsearch start

You should see the following output

$ sudo bin/service/elasticsearch start
Starting ElasticSearch. Detected Mac OSX and installed launchd daemon.
Waiting for ElasticSearch...
running: PID:57767

Note: The pid number will be different on your system

Check the service is ok by opening up a browser on http://localhost:9200, you should see the following output

"ok" : true,
"name" : "Bova",
"version" : {
"number" : "0.18.5",
"date" : "2011-03-01T19:07:42",
"snapshot_build" : false
"tagline" : "You Know, for Search",
"cover" : "DON'T PANIC",
"quote" : {
"book" : "The Hitchhiker's Guide to the Galaxy",
"chapter" : "Chapter 30",
"text1" : "\"The chances of finding out what's really going on in the universe are so remote, the only thing to do is hang the sense of it and keep yourself occupied. Look at me, I design fjords. I'd far rather be happy than right any day.\"",
"text2" : "\"And are you?\"",
"text3" : "\"No, that's where it all falls apart I'm afraid.\"",
"text4" : "\"Pity, it sounded like quite a nice lifestyle otherwise.\""

Stopping Elastic search

use a similar command to starting as shown above.
$cd /usr/local/share/elasticsearch
$sudo bin/service/elasticsearch stop


Brady J. Frey said...

Thank you very much for the directions, this was a great help ever for .16!

Just a note, you had one typo:
sudo chmod -R root:wheel elasticsearch

You meant chown not chmod;)

Tim Hawkins said...

Thanks Brady, Correction applied

Unknown said...

That worked well, thanks.

Like Brandy said, this:
sudo chmod -R root:wheel elasticsearch

Should read:
sudo chown -R root:wheel elasticsearch

Also in the move commands above the filename is 1.15 rather than 0.15 which was right at the time. At the time of writing this the version number is 0.18.5, so the 1.15 reference made me wonder if I had accidentally downloaded some ancient version

Tim Hawkins said...

Thanks unknow, I have applied the corrections you have outlined.

mhenrixon said...

what's wrong with homebrew?

"brew update"
"brew install elasticsearch"
"mkdir -p ~/Library/LaunchAgents
"ln -nfs /usr/local/Cellar/elasticsearch/0.18.6/org.elasticsearch.plist ~/Library/LaunchAgents/"
"launchctl load -wF ~/Library/LaunchAgents/org.elasticsearch.plist"

Enrica said...

Thanks for the guide!! :-)

irfan said...

Thank you for posting this link on the Google Groups!

I am just trying it now.

In the root of my server, I have the bin, config, lib, and service dirs from the elasticsearch package and the service-wrapper.

I did not make the symbolic link as I didn't see the need as I put the contents of the elasticsearch tar into the root and have no elasticsearch-version dir.

But when I try to start the service with bin/service/elasticsearch start, I get an error that bin/service/elasticsearch command not found

mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)

Abhishek Kasina said...

Great guide. SImple and to the point. Thank a lot :-)

Riki Risnandar said...

im using elasticsearch 0.90.9 and this tutorial still works.. thank you

Anonymous said...

Just followed these steps - Jan 2014, still works! Thanks

Ferozfirru said...

Iam getting this error,
"elasticsearch may have failed to start "

Daniel said...

Use this page to download it (not the github link given in the post).

Also, the service wrapper doesn't appear to be necessary.

Anonymous said...

Allrighty !
It Works !
for v 1.12.1 as well (June, 2014)