在/lib/systemd/system下建立nacos.service,如下内容
[Unit]
Description=nacos
After=network.target
[Service]
Environment="JAVA_HOME=/root/soft/jdk1.8.0_202"
Type=forking
ExecStart=/root/soft/nacos/binstartup.sh -m standalone
ExecReload=/root/soft/nacos/bin/shutdown.sh
ExecStop=/root/soft/nacos/bin/shutdown.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
设置自动启动
systemctl enable nacos
开启与关闭
systemctl start nacos
systemctl stop nacos