Installing ElasticSearch on Ubuntu (August 2014)


If you are trying to install elasticsearch on Ubuntu, you may run into a mysterious error where running the suggested

sudo /etc/init.d/elasticsearch start

appears to succeed, but no process is bound to port 9200, and the elasticsearch logs remain empty. If this is the case, I suggest running the elasticsearch binary directly. If you installed elasticsearch from the .deb installer, the elasticsearch binary is found at /usr/share/elasticsearch/bin/elasticsearch.

In my case, running the elasticsearch binary directly on my Ubuntu machine threw a Java ‘Unsupported major.minor version 51.0’ exception. This occurred immediately, apparently before logging started, so /var/log/elasticsearch remained empty. It turns out that as of elasticsearch 1.2, which was released fairly recently, elasticsearch requires Java 7, but Ubuntu’s default-jre package ships Java 6.

To rectify this situation, install Java 7 (you can either use the openjdk-7-jre package or the oracle-java7-installer provided by ppa:webupd8team/java.) After installing Java 7, elasticsearch should start correctly, either directly from the binary or via the init script.

(The above is based on Ubuntu 12.04.)

Get Notified of New Posts

* indicates required