Logstash 7.1.0 does not start as service RHEL 7

I just installed logstash 7.1.0 from an RPM with sudo yum install logstash.7.1.0.rpm system has 32 GB RAM.

When im trying to run the service as

[root@elk02 ~]# sudo systemctl start logstash
Failed to start logstash.service: Unit not found.

[root@elk02 ~]# java -version
java version "1.8.0_231"
Java(TM) SE Runtime Environment (build 1.8.0_231-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.231-b11, mixed mode)

[root@elk02 ~]# sudo /usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd
could not find java; set JAVA_HOME or ensure java is in PATH

[root@elk02 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export JAVA_HOME=/opt/jdk1.8.0_231
export JRE_HOME=/opt/jdk1.8.0_231/jre
PATH=$PATH:$JAVA_HOME/bin:$HOME/bin

export PATH

Why am i getting the above two errors? How do i fix this?

Hi Team,
Kindly help me fix this issue.
I have made a change in the startup.options further to provide the java binary as
JAVACMD=/opt/jdk.1.8.0_231/bin/java
and tried to run ./system-install. And i still face the JAVA issue.
could not find java; set JAVA_HOME or ensure java is in PATH

If you are already root why are you using sudo?

Solved this issue by adding
JAVA_HOME=/path/to/jdk
and
JAVACMD=/path/to/jdk/bin/java
on the startup.options file.

@badger, I with/without sudo did not make any difference in my error. I have come to find a solution thou :slight_smile: Thank you very much for looking out for this :slight_smile:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.