正常情况下,我们可以从nacos的官网跳转到github上下载,但是大多数的时候,国内的网络不能直接访问国外的github,需要翻墙才可以。但是码云(http://www.gitee.com)统一每天从github上面同步nacos的源码,所以我们可以在码云上面更新源码,使用nacos源码安装。
在码云上nacos的地址:https://gitee.com/mirrors/Nacos?_from=gitee_search ,然后选择clone地址

git clone https://gitee.com/mirrors/Nacos.git
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
打包成功之后,在distribution\target 目录可以找到安装包:

将安装包nacos-server-2.1.0.tar.gz 上传到服务器(我用的是Linux服务器),然后解压
tar -xvf nacos-server-2.1.0.tar.gz
这里只是为了方便开发,默认选择以单服启动而不是集群启动,集群启动另外再说
startup.sh -m standalone
其它详细的功能,可以参考官网:https://nacos.io/zh-cn/docs/quick-start.html
[root@localhost bin]# ./startup.sh -m standalone
-bash: ./startup.sh: /bin/bash^M: 解释器错误: No such file or directory
这个是因为我是在windows上面打包的,所以生成的startup.sh文件格式是dos的,而linux或unix是不能运行dos格式的文件的,需要进行一下转换:
[root@localhost bin]# dos2unix startup.sh
dos2unix: 正在转换文件 startup.sh 为Unix格式...
这样再次运行就可以了: ./startup.sh -m standalone