标签:变量 start bit gre ast ash dir root ensure
在安装logstash时出现如下报错:“could not find java; set JAVA_HOME or ensure java is in PATH
chmod: cannot access ‘/etc/default/logstash’: No such file or directory
warning: %post(logstash-1:6.6.0-1.noarch) scriptlet failed, exit status 1”
could not find java; set JAVA_HOME or ensure java is in PATH
chmod: cannot access ‘/etc/default/logstash’: No such file or directory
warning: %post(logstash-1:6.6.0-1.noarch) scriptlet failed, exit status 1
原以为是jdk没有安装经查是正常的。但启动logstash 的时候也是报错的。
[root@ES3-4 opt]# java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
猜测应该是环境变量的事了。
[root@ES4-4 config]# echo $PATH
/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
但是发现是有的。
查看整个系统的变量,发现没有,应该就是这个问题了。
[root@kafka1-master preuser-0]# set |grep JAVA_HOME
解决步骤如下:
1、设置变量
[root@ES3-4 opt]# vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:/usr/local/jdk/bin
[root@ES3-4 opt]# source ~/.bash_profile
2、查看变量值
[root@ES3-4 opt]# set |grep JAVA_HOME
JAVA_HOME=/usr/local/jdk
3、重新安装ok了,问题解决。
[root@ES3-4 opt]# rpm -ivh logstash-6.6.0.rpm
warning: logstash-6.6.0.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:logstash-1:6.6.0-1 ################################# [100%]
Using provided startup.options file: /etc/logstash/startup.options
Successfully created system startup script for Logstash
could not find java;set JAVA_HOME or ensure java报错
标签:变量 start bit gre ast ash dir root ensure
原文地址:https://blog.51cto.com/liqingbiao/2413505