3

On fresh install Ubuntu 16.04 I use next steps to install ElasticSearch 5.0.1 or 5.0.2 and ES failed to start. Does anyone know how can I run ES 5.x on Ubuntu 16.04 or 14.04?

  1. su
  2. add-apt-repository ppa:webupd8team/java
  3. apt-get update
  4. apt-get upgrade
  5. apt-get install oracle-java8-installer
  6. java -version
  7. wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
  8. apt-get install apt-transport-https
  9. echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list

  10. apt-get update && sudo apt-get install elasticsearch

  11. service elasticsearch status

Elasticsearch 5.x failed to start on Ubuntu 16.04. Does anyone know how can I run ES 5.x on Ubuntu 16.04 or 14.04?

I also try with the new version of Elasticsearch 5.1.1 with this few steps

  1. su
  2. apt-get purge elasticsearch
  3. apt-get update
  4. apt-get upgrade
  5. apt-get install elasticsearch

-- new version elasticsearch 5.1.1 is installed

  1. now if I check status I get this

service elasticsearch status

● elasticsearch.service - Elasticsearch Loaded: loaded (/usr/lib/systemd/system/elasticsearch.service; disabled; vendor preset: enabled)

Active: inactive (dead)

 Docs: http : / / www.elastic.co

Dec 09 22:49:49 elastic systemd[1]: Stopped Elasticsearch.

1
  • Also it's worth to check whether java is installed. Cause the log message that no java binaries available falls into journalctl not under elasticsearch.service tag.
    – origaminal
    May 24, 2017 at 22:58

5 Answers 5

2

I had the same issue and I saw that the group of my elasticsearch.yml file was not right. You can check it by using:

ubuntu@mymachine:~$ sudo ls -al /etc/elasticsearch/
total 24
drwxr-x---  3 root elasticsearch 4096 Dec 19 10:58 .
drwxr-xr-x 94 root root          4096 Dec 19 10:58 ..
-rw-rw----  1 root elasticsearch 3069 Dec  6 12:39 elasticsearch.yml
-rw-rw----  1 root elasticsearch 2862 Dec  6 12:39 jvm.options
-rw-rw----  1 root elasticsearch 3992 Dec  6 12:39 log4j2.properties
drwxr-x---  2 root elasticsearch 4096 Dec  6 12:39 scripts

It can be that the elasticsearch.yml is in the root group.

-rw-rw----  1 root root   3069 Dec  6 12:39 elasticsearch.yml

When I changed the group I was able to start elasticsearch again.

$ sudo chgrp elasticsearch /etc/elasticsearch/elasticsearch.yml
1
  • Thank's for advise, but I still can not run ES on Ubuntu even if I try to change the group of a file as you said. I get: Loaded: loaded, Active: failed, elasticsearch.service: Failed with result exit-code.
    – Pajsije
    Dec 19, 2016 at 22:41
2

I was sceptical and thought I would not be able to find the answer to this question but your (@user305883) advice turned out to be a good. Thanks for help.

I changed /etc/elasticsearch/jvm.option -Xms2g and -Xmx2g to #-Xms2g and #-Xmx2g and on ubuntu terminal after I run this command

service elasticsearch start

ES run well on Ubuntu 16.04.

This was right answer. Thanks again to @user305883. stackoverflow

1

Worked for me. My jvm.options file:

## JVM configuration

################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

--- Commented out ---

#-Xms2g
#-Xmx2g

--- Commented out ---

```

Worked for me as above. Thank you.

1
  • Above solution will work if you do not set network.host in yml file. WHEN YOU SET e.g. *** network.host: "192.168.1.72" *** in elasticsearch.yml file it stopped starting again. :) I found in logs that it actually now need the same initial and maximum size of heap so I HAVE UNCOMMENTED -Xmg2g and -Xmx2g
    – Matt Janda
    Mar 27, 2017 at 0:16
1

I have been facing the same issue (i.e permission denied error while accessing /etc/elasticsearch), I have installed ES 6.0.1 and somehow my ES was failed to start. I came to know that my ES service script located in /etc/init.d/elasticsearch can not be able to read the following files need to run ES: 1) /etc/elasticsearch/elasticsearch.yml 2) /etc/elasticsearch/jvm.options 3) /etc/elasticsearch/log4j2.properties

So, what I did is first given elasticsearch the executable rights:

/etc$ sudo chmod +x elasticsearch

Then after, I given the permission of all the files located in /etc/elasticsearch like this:

/etc/elasticsearch$ sudo chmod 777 .

And then I just restart ES Like this:

sudo systemctl restart elasticsearch

Now, ES is working fine and you can test it by issuing following command

curl -X GET "localhost:9200"
0

make sure /etc/elasticsearch/log4j2.properties exists, otherwise create it:

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console
1
  • On fresh install Ubuntu 16.04 after I install elasticsearch 5.0.1 or 5.0.2 with update, log4j2.properties file exist in /etc/elasticsearch directory & ES is failed to start. This is not the right answer.
    – Pajsije
    Dec 6, 2016 at 4:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .