Skip to content

Instantly share code, notes, and snippets.

@rajraj rajraj/es.sh forked from aaronshaf/es.sh
Created Jan 3, 2012

Embed
What would you like to do?
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
curl -L http://github.com/elasticsearch/elasticsearch-servicewrapper/tarball/master | tar -xz
mv *servicewrapper*/service /usr/local/share/elasticsearch/bin/
rm -Rf *servicewrapper*
sudo /usr/local/share/elasticsearch/bin/service/elasticsearch install
sudo /etc/init.d/elasticsearch start
#curl http://localhost:9200
@gamafranco

This comment has been minimized.

Copy link

gamafranco commented May 23, 2012

This is great. Works like a charm. Thanks.

@jaimegago

This comment has been minimized.

Copy link

jaimegago commented Jul 23, 2012

+1 thanks man!

@jurgens

This comment has been minimized.

Copy link

jurgens commented Jul 26, 2012

Worked for me perfectly!

@rubytastic

This comment has been minimized.

Copy link

rubytastic commented Sep 4, 2012

+Awsome
Saves another 30 minutes digging docs, worked perfect! big thx!

@bicatu

This comment has been minimized.

Copy link

bicatu commented Sep 27, 2012

Two things:
a) remove the .686 from the first yum
b) use https instead of http for the

http://github.com/elasticsearch/elasticsearch-servicewrapper

@zimmen

This comment has been minimized.

Copy link

zimmen commented Oct 2, 2012

Superb!

@jprante

This comment has been minimized.

Copy link

jprante commented Dec 10, 2012

Caution:

  • do not run elasticsearch with root, set up a user in the servicewrapper, chown -R the files
  • there are better places to install java apps than /usr/local/share, e.g. /opt
@gondo

This comment has been minimized.

Copy link

gondo commented Apr 14, 2013

by following the example above (using elasticsearch-servicewrapper) im getting:
Starting ElasticSearch...
Waiting for ElasticSearch.....................
WARNING: ElasticSearch may have failed to start.
however starting ES via bin/elasticsearch works

@valuko

This comment has been minimized.

Copy link

valuko commented May 12, 2013

In addition to what @jprante said, Set your ES_HOME and ES_HEAP_SIZE in the elasticsearch.conf before starting the service. Great work anyways.

@jjmerino

This comment has been minimized.

Copy link

jjmerino commented May 14, 2013

ty!

@glennjacobs

This comment has been minimized.

Copy link

glennjacobs commented Jun 21, 2013

Many thanks!!

@inspire22

This comment has been minimized.

Copy link

inspire22 commented Jun 24, 2013

@valuko how to set ES_HEAP_SIZE in the conf? It says to use an env variable (though I'd prefer the conf)

@matthewmrichter

This comment has been minimized.

Copy link

matthewmrichter commented Jun 27, 2013

Download an RPM from http://www.elasticsearch.org/download/ then do sudo yum (name).rpm

@chappyhome

This comment has been minimized.

Copy link

chappyhome commented Sep 1, 2013

good

@vladakilov

This comment has been minimized.

Copy link

vladakilov commented Oct 7, 2013

The elasticsearch download url (line 5) is outdated, I get a 404, should be https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.5.tar.gz

@tom-haines

This comment has been minimized.

Copy link

tom-haines commented Oct 14, 2013

Excellent, thanks.

@raynoppe

This comment has been minimized.

Copy link

raynoppe commented Oct 18, 2013

Had to make a few adjustments but worked a charm. Thanks!

@gta-am

This comment has been minimized.

Copy link

gta-am commented Oct 29, 2013

nice

@richarddowner

This comment has been minimized.

Copy link

richarddowner commented Nov 19, 2013

Awesome

@nezkal

This comment has been minimized.

Copy link

nezkal commented Dec 3, 2013

Perfect! Nice

@allenmchan

This comment has been minimized.

Copy link

allenmchan commented Dec 14, 2013

Does anyone know how to do an upgrade using service wrapper?

@antonbabenko

This comment has been minimized.

Copy link

antonbabenko commented Jan 19, 2014

Thanks for it! Now there are repos for elasticsearch - http://www.elasticsearch.org/blog/apt-and-yum-repositories/

@chaitu6022

This comment has been minimized.

Copy link

chaitu6022 commented Jan 28, 2014

This Works, thaks a lot ! :)

@jamesmcfadden

This comment has been minimized.

Copy link

jamesmcfadden commented Feb 16, 2014

Great little resource, thanks a lot!

@kzoutzeling-sugarcrm

This comment has been minimized.

@mitulgolakiya

This comment has been minimized.

Copy link

mitulgolakiya commented Apr 19, 2014

Elasticsearch installed successfully...
But getting an error while installing plugin...

Error: Could not find or load main class org.elasticsearch.plugins.PluginManager

I am executing following command:
/usr/local/share/elasticsearch/bin/plugin -install mobz/elasticsearch-head

What can be the problem ??

@VanitySoft

This comment has been minimized.

Copy link

VanitySoft commented May 13, 2014

works perfectly. Thanks!

@alvarogarcianewshore

This comment has been minimized.

Copy link

alvarogarcianewshore commented Jun 11, 2014

Thanks for the gist. Very useful, even though I installed with a repo :) +1

@qiaohaijun

This comment has been minimized.

Copy link

qiaohaijun commented Aug 26, 2014

give me a good help

@vantienvnn

This comment has been minimized.

Copy link

vantienvnn commented Dec 9, 2014

Cool, thank you

@fertobar

This comment has been minimized.

Copy link

fertobar commented Dec 18, 2014

@stevebanik

This comment has been minimized.

Copy link

stevebanik commented Jan 23, 2015

Thanks for this quick and easy script. How can I set HEAP (-Xmx and -Xms) when using the wrapper?

@stevebanik

This comment has been minimized.

Copy link

stevebanik commented Jan 23, 2015

Nevermind, just discovered that JVM level configuration (such as -X parameters) should be set within the elasticsearch.conf file. The ES_HEAP_SIZE environment variable controls the maximum memory allocation for the JVM (set in megabytes). It defaults to 1024.

@MarcoM5

This comment has been minimized.

Copy link

MarcoM5 commented Mar 3, 2015

Nice 😄

@zmonteca

This comment has been minimized.

Copy link

zmonteca commented Mar 10, 2015

Bam! Nice.

Does "server elasticsearch start" on CentOS not work for anyone else?

@eduardolucioac

This comment has been minimized.

Copy link

eduardolucioac commented Jun 5, 2015

If you get the error ...

"
WARNING: ElasticSearch may have failed to start.
"

... try to use "servicewrapper" version 0.90. That version is compatible with ElasticSearch "0.19.9" or above.

servicewrapper 0.90 -> https://github.com/elastic/elasticsearch-servicewrapper/tree/0.90
Reference -> http://stackoverflow.com/questions/21724836/elasticsearch-may-have-failed-to-start-tried-multiple-versions

@damehta

This comment has been minimized.

Copy link

damehta commented Jun 8, 2016

@zmonteca, Not sure if you got it working for you. try "sudo service elastic search start"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.