VM搭建nacos供本机windows访问

2020-12-03  本文已影响0人  Lolipiza

1.下载nacos
[官方github]https://github.com/alibaba/nacos/releases
2.关闭防火墙及安全策略

// 关闭防火墙

systemctl stop firewalld

systemctl disable firewalld

// 关闭linux自身的一些安全策略

sed -i 's/SELINUX=enforcing/SELINUX=disabled/'  /etc/sysconfig/selinux

setenforce 0

3.启动nacos(我是单机模式,启动命令加参数)

sh startup.sh -m standalone

4.windows浏览器访问
http://你的虚拟机IP:8848/nacos/#/login
默认账户密码都为nacos

--
设置开机自启动:
1.vi /lib/systemd/system/nacos.service

[Unit]
Description=nacos server
Documentation=https://nacos.io/zh-cn/docs/what-is-nacos.html
# 依赖服务,仅当依赖的服务启动之后再启动自定义的服务
# After=

[Service]
# 启动类型,包括simple、forking、oneshot、notify、dbus
Type=forking
# pid文件路径
# PIDFile=/var/run/nginx.pid
# 启动前执行的操作
# ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
# 启动命令
ExecStart=/bin/sh /opt/nacos/bin/startup.sh -m standalone
# 重载命令
# ExecReload=
# 停止命令
ExecStop=/bin/sh /opt/nacos/bin/shutdown.sh
# 是否给服务分配独立的临时空间
PrivateTmp=true

[Install]
# 服务安装的用户模式,一般使用multi-user即可
WantedBy=multi-user.target

2.加入服务,并设置开机自启
systemctl daemon-reload
systemctl enable nacos.service

另外手动开启/关闭服务:
systemctl start nacos.service
systemctl stop nacos.service

上一篇下一篇

猜你喜欢

热点阅读