Skip to content

Instantly share code, notes, and snippets.

@rajraj
Forked from aaronshaf/es.sh
Created January 3, 2012 20:07
Show Gist options
  • Select an option

  • Save rajraj/1556657 to your computer and use it in GitHub Desktop.

Select an option

Save rajraj/1556657 to your computer and use it in GitHub Desktop.
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
@gondo

gondo commented Apr 14, 2013

Copy link
Copy Markdown

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

valuko commented May 12, 2013

Copy link
Copy Markdown

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

Copy link
Copy Markdown

ty!

@glennjacobs

Copy link
Copy Markdown

Many thanks!!

@inspire22

Copy link
Copy Markdown

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

@matthewmrichter

Copy link
Copy Markdown

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

@chappyhome

Copy link
Copy Markdown

good

@vladakilov

Copy link
Copy Markdown

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

Copy link
Copy Markdown

Excellent, thanks.

@raynoppe

Copy link
Copy Markdown

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

@gta-am

gta-am commented Oct 29, 2013

Copy link
Copy Markdown

nice

@richarddowner

Copy link
Copy Markdown

Awesome

@arturmagalhaesjr

Copy link
Copy Markdown

Perfect! Nice

@allenmchan

Copy link
Copy Markdown

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

@antonbabenko

Copy link
Copy Markdown

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

@chaitu6022

Copy link
Copy Markdown

This Works, thaks a lot ! :)

@mcfdn

mcfdn commented Feb 16, 2014

Copy link
Copy Markdown

Great little resource, thanks a lot!

@kzoutzeling-sugarcrm

Copy link
Copy Markdown

@mitulgolakiya

Copy link
Copy Markdown

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

Copy link
Copy Markdown

works perfectly. Thanks!

@alvarogarcianewshore

Copy link
Copy Markdown

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

@qiaohaijun

Copy link
Copy Markdown

give me a good help

@vantienvnn

Copy link
Copy Markdown

Cool, thank you

@fertobar

Copy link
Copy Markdown

@stevebanik

Copy link
Copy Markdown

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

@stevebanik

Copy link
Copy Markdown

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

MarcoM5 commented Mar 3, 2015

Copy link
Copy Markdown

Nice 😄

@zmonteca

Copy link
Copy Markdown

Bam! Nice.

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

@eduardolucioac

Copy link
Copy Markdown

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

damehta commented Jun 8, 2016

Copy link
Copy Markdown

@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