Unable to install Logstash 5.0 - Need help

Hello,

I'm able to install Elasticsearch 5.0 and Kibana 5.0 successfully.

Running on Linux 3.10.0-123.el7.x86_64.

Installing Logstash 5.0 through YUM following the steps provided in https://www.elastic.co/guide/en/logstash/5.0/installing-logstash.html and facing issue which says "Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME"

Verified Java version:

$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

Using the following repo config

[logstash-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x-prerelease/yum
gpgcheck=0
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Installed logstash using sudo yum install logstash

Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
** Installing : 1:logstash-5.0.0-1.noarch 1/1**
Could not find any executable java binary. Please install java in your PATH or set JAVA_HOME.
warning: %post(logstash-1:5.0.0-1.noarch) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package 1:logstash-5.0.0-1.noarch
** Verifying : 1:logstash-5.0.0-1.noarch 1/1**

Installed:
** logstash.noarch 1:5.0.0-1

Complete!

I do have JAVA_HOME configured and PATH as well.

$echo $JAVA_HOME
/opt/jdk1.8.0_101

$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/wmsadmin/.local/bin:/home/wmsadmin/bin:/opt/jdk1.8.0_101/bin:/opt/jdk1.8.0_101/jre/bin

Please help how to fix this issue. Already spent much time trying to figure this out .

Appreciate your help.

Regards
VJ.

You aren't using the GA version here, you may want to update the URL.

Hi Mark,

Thanks for you reply. Sorry that was a typo. I'm actually using following repo with GA version only:

[logstash-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=0
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md

Hi,

I'm finally able to fix this issue by adding JAVA_HOME in logstash.lib.sh file:

Thank you.
Vj.

You might call this manual editing a fix. But for those of us writing installation script, this is certainly a nightmare.

What this means is that java was not installed for all users using a method like this one which uses the Oracle JDK RPM, and alternatives to make that Java the system default. The root user should automatically have this java as its default, otherwise the post-install script will not be able to find and call java (which it does as part of the setup process).

Hi,

I followed same method like this one to setup JDK 8. But for some reason, JAVA_HOME is flipping to JDK 7 which was installed earlier once I close the terminal and reopen it.

Manually updating logstash.lib.sh with JAVA_HOME might not be a good approach to fix it, but I just wanted to finish the ELK setup.

I might need to do some more research on how to automatically have JDK 8 as default.

Thank you
VJ.

That's what the alternatives command is supposed to do.