报错信息:
[root@localhost bin]# bash startup.sh -m standalone 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! !!
解决方法:
配置JAVA_HOME
[root@localhost ~]# which java //找到jdk位置 /usr/bin/java [root@localhost ~]# ll /usr/bin/java lrwxrwxrwx. 1 root root 22 2月 24 12:26 /usr/bin/java -> /etc/alternatives/java [root@localhost ~]# ll /etc/alternatives/java lrwxrwxrwx. 1 root root 73 2月 24 12:26 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/jre/bin/java [root@localhost ~]# ll /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64/ [root@centos7-2 nacos]# vi /etc/profile # 在最后增加 export JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.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 [root@localhost ~]# source /etc/profile
测试启动:
[root@localhost bin]# sh startup.sh -m standalone /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08- .... -server.max-http-header-size=524288 nacos is starting with standalone //说明启动成功 nacos is starting,you can check the /usr/local/nacos/logs/start.out [root@localhost bin]# cat /usr/local/nacos/logs/start.out /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64//bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Djava.ext.dirs=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64//jre/lib/ext:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64//lib/ext -Xloggc:/usr/local/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/usr/local/nacos/plugins/health,/usr/local/nacos/plugins/cmdb,/usr/local/nacos/plugins/mysql -Dnacos.home=/usr/local/nacos -jar /usr/local/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/usr/local/nacos/conf/ --logging.config=/usr/local/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 ,--. ,--.'| ,--,: : | Nacos 1.2.1 ,`--.'`| ' : ,---. Running in stand alone mode, All function modules | : : | | ' ,'\ .--.--. Port: 8848 : | \ | : ,--.--. ,---. / / | / / ' Pid: 3882 | : ' '; | / \ / \. ; ,. :| : /`./ Console: http://xxxx:8848/nacos/index.html ' ' ;. ;.--. .-. | / / '' | |: :| : ;_ | | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io ' : | ; .' ," .--.; |' ; :__| : | `----. \ | | '`--' / / ,. |' | '.'|\ \ / / /`--' / ' : | ; : .' \ : : `----' '--'. / ; |.' | , .-./\ \ / `--'---' '---' `--`---' `----' 2020-04-14 01:03:32,993 INFO Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConf [root@localhost bin]# ss -antulp | grep 8848 tcp LISTEN 0 100 :::8848 :::* users:(("java",pid=3882,fd=165))