Linux安装nacos 启动报错解决: which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
报错信息:which: no javac in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin) readlink: 缺少操作数 Try 'readlink --help' for more information. dirname: 缺少操作数 Try 'dirname --help' for more information. ERROR: Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! !!
解决方法:jdk环境变量配置JAVA_HOME
# 1. 找到jdk位置 ,输入命令:
which java
# 2.继续查看,输入命令:
ll /usr/bin/java
# 3. 继续查看java信息,输入命令:
ll /etc/alternatives/java
#4.继续查看,输入命令:
ll /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-10.ky10.x86_64
注:此时如果环境变量未配置的话则返回空
# 5.进行配置,输入命令:
vi /etc/profile
# 在最后增加
export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.312.b07-10.ky10.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
# 6.第5步保存退出,输入命令:
source /etc/profile
# 7.再次单机版启动:
sh startup.sh -m standalone 或者 ./startup.sh -m standalone
# 8.查看启动情况。输入命令:
cat /你的nacos安装路径/logs/start.out
根据我的路径进行查看的命令:cat /root/app/01nacos/logs/start.out
/root/app/01nacos/logs/start.out
# 9.查看8848 端口情况:
ss -antulp | grep 8848