开机自启动
cd /lib/systemd/system/
增加文件
vim nacos.service
添加如下:
[Unit]
Description=nacos
After=network.target[Service]
Environment="JAVA_HOME=/root/java/jdk-11.0.11-j9"
Type=forking
ExecStart=/root/java/nacos/bin/startup.sh -m standalone
ExecReload=/root/java/nacos/bin/shutdown.sh
ExecStop=/root/java/nacos/bin/shutdown.sh
PrivateTmp=true[Install]
WantedBy=multi-user.target
赋予权限
chmod 775 nacos
保存退出后,执行以下命令
systemctl daemon-reloadsystemctl enable nacos.servicesystemctl start nacos.service