预备环境
要具备jdk8+、maven3.2+的环境。
下载安装
github下载源码
git clone https://github.com/alibaba/nacos.git
cd nacos/
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U
ls -al distribution/target/
// change the $version to your actual path
cd distribution/target/nacos-server-$version/nacos/bin
下载编译后的压缩包 推荐使用
您可以从 最新稳定版本 下载 nacos-server-$version.zip 包。
unzip nacos-server-$version.zip 或者 tar -xvf nacos-server-$version.tar.gz
cd nacos/bin
推荐使用压缩包下载方式,因为可以更便利的选择版本,且不需要手动编译。
修改配置文件
修改conf目录下的application.properties文件。
设置其中的nacos.core.auth.plugin.nacos.token.secret.key值,详情可查看鉴权-自定义密钥.
必须要设置,不然启动报错!!可以先用默认值,如果不用默认值,则生成Base64编码字符不低于32的字符串。
注意,文档中的默认值
SecretKey012345678901234567890123456789012345678901234567890123456789和VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=为公开默认值,可用于临时测试,实际使用时请务必更换为自定义的其他有效值。
启动
启动命令(standalone代表着单机模式运行,非集群模式):
Linux/Unix/Mac
sh startup.sh -m standalone
如果您使用的是ubuntu系统,或者运行脚本报错提示[[符号找不到,可尝试如下运行:
bash startup.sh -m standalone
Windows
startup.cmd -m standalone
登录
启动后,打开localhost:8848/nacos登录,账号密码默认均为nacos。
进入后为启动成功。
