我刚刚使用sudo yum install logstash.7.1.0.rpm
从RPM安装了logstash 7.1.0
系统具有32 GB RAM。
当我尝试以
的身份运行服务时[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
为什么会出现上述两个错误?我该如何解决?