一、下载nacos
https://github.91chi.fun/https://github.com//alibaba/nacos/releases/download/2.1.0/nacos-server-2.1.0.tar.gz
二、上传并解压nacos
tar -xzvf nacos-server-2.1.0.tar.gz
三、启动nacos
cd /nacos/bin sh startup.sh -m standalone
如果输入如下信息,恭喜你成功了。
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/bin/java -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.332.b09-1.el7_9.x86_64/lib/ext -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -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/selector -Dnacos.home=/usr/local/nacos -jar /usr/local/nacos/target/nacos-server.jar --spring.config.additional-location=file:/usr/local/nacos/conf/ --logging.config=/usr/local/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos is starting with standalone nacos is starting,you can check the /usr/local/nacos/logs/start.out
我安装的是openjdk,报错
ERROR: Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! !!
1、配置JAVA_HOME
#查找java按照路径 which java ls -lrt /usr/bin/java ls -lrt /etc/alternatives/java #编辑配置文件 vim /etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.322.b06-1.el7_9.x86_64/jre/bin/java #刷新配置文件 source /etc/profile
继续执行sh startup.sh -m standalone
2、安装javac
yum install java-1.8.0-openjdk-devel.x86_64
3、再次启动单机模式
四、访问验证
http://xxx.xxx.xxx.xxx:8848/nacos/
账号:nacos 密码:nacos