Installing ElasticSearch on Ubuntu 12.04

2019-03-20 17:34发布

问题:

I have a VM running Ubuntu 12.04, and am trying to install ElasticSearch. I have followed this gist in the best 'learn X the hard way' spirit, and everything installs fine - packages are downloaded, untarred, copied to right place etc.

The problem comes when I run it - either by calling:

$ /usr/local/share/elasticsearch/bin/elasticsearch

or by using the service wrapper ($ rselasticsearch console)

The output is logged to wrapper.log and is included below. I think that I may be having JAVA home / classpath issues, but am not sure.

Any help most gratefully received!

Running ElasticSearch...
wrapper  | Unable to write to the configured log directory: /usr/local/share/elasticsearch/logs (No such file or directory)
wrapper  |   The directory does not exist.
wrapper  | Unable to write to the configured log file: /usr/local/share/elasticsearch/logs/service.log (No such file or directory)
wrapper  |   Falling back to the default file in the current working directory: wrapper.log
wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 32-bit 3.5.14
wrapper  |   Copyright (C) 1999-2011 Tanuki Software, Ltd. All Rights Reserved.
wrapper  |     http://wrapper.tanukisoftware.com
wrapper  | 
wrapper  | Launching a JVM...
jvm 1    | WrapperManager: Initializing...
jvm 1    | WrapperSimpleApp Error: Unable to locate the class org.elasticsearch.bootstrap.ElasticSearchF : java.lang.ClassNotFoundException: org.elasticsearch.bootstrap.ElasticSearchF
jvm 1    | 
jvm 1    | WrapperSimpleApp Usage:
jvm 1    |   java org.tanukisoftware.wrapper.WrapperSimpleApp {app_class{/app_method}} [app_arguments]
jvm 1    | 
jvm 1    | Where:
jvm 1    |   app_class:      The fully qualified class name of the application to run.
jvm 1    |   app_arguments:  The arguments that would normally be passed to the
jvm 1    |                   application.
wrapper  | JVM exited while loading the application.
...
wrapper  | There were 5 failed launches in a row, each lasting less than 300 seconds.  Giving up.
wrapper  |   There may be a configuration problem: please check the logs.
wrapper  | <-- Wrapper Stopped

Update

Given that we are now in 2016, the easiest way to run ES on Ubuntu is to use Docker. docker run elasticsearch will download the latest and run it in the foreground, and obviously you can run it as a daemon, or run a specific version (e.g. elasticsearch:1.7.2), and set the ports etc.

回答1:

Word of warning to anyone trying what I did before - the URL specified in the Gist is to the source version, not the compiled version, hence there being no *.class files.

You can use the Gist as is, but substitute the latest download URL from the ElasticSearch site instead of the github URL that is there at the moment, e.g.:

....
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.1.1.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
sudo mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
...

** This is the lastest version as of 20/5/2014. To get more updated version, visit this page, right click on the TAR link (under Downloads Section), copy the link and replace the wget argument in the first line.



回答2:

I installed elasticsearch the same way you did and ran into the same issue. In the end I fixed the issue by installing the compiled version rather than from github. It involves using the same steps as the gist, except use the tar from http://www.elasticsearch.org/download/2012/12/27/0.20.2.html rather than github. I forked and updated the gist, which is available at https://gist.github.com/4512530. Hope this helps.



回答3:

follow this step and easily configer an Elastic Search.

Step 1 — Installing Java :

$ sudo apt-get update 

$ sudo apt-get install openjdk-7-jre 

$ java -version 

Step 2 — Downloading and Installing Elasticsearch :

$ wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.7.2.deb 

$ sudo dpkg -i elasticsearch-1.7.2.deb 

$ sudo update-rc.d elasticsearch defaults

Step 3 — Configuring Elastic :

$ sudo nano /etc/elasticsearch/elasticsearch.yml

node.name: "My First Node" cluster.name: mycluster1

$ sudo service elasticsearch start 

Step 4 — Securing Elastic :

$ sudo nano /etc/elasticsearch/elasticsearch.yml 

network.bind_host: localhost

script.disable_dynamic: true

Step 5 — Testing :

$ curl -X GET 'http://localhost:9200' or run http://localhost:9200 in any browser. 

You should see the following response:

{ 
"status" : 200,
"name" : "Harry Leland",
"cluster_name" : "elasticsearch",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}

Refrence By:

http://laravelcode.com/post/how-to-install-elastic-search-in-local-system-and-live-server



回答4:

Depackaging the deb file available on the elasticsearch website worked fine for me:

sudo dpkg -i elasticsearch-1.1.1.deb



回答5:

Installing through apt as documented at https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html seems to work well.