Don't want to start the terminal every time? Come and learn how to deploy Nacos services on Windows
About 309 wordsAbout 1 minNovember 21, 2024
Method 1: Directly Running
We can directly run Nacos's startup script to start the service.
Steps
- Download and extract the Nacos package.
- Navigate to the
bin
directory. - Execute the startup command:
startup.cmd
Method 2: Using Windows Service
We can register Nacos as a Windows service to manage it automatically.
Steps
- Download and extract the Nacos package.
- Download
nssm
(Non-Sucking Service Manager), an open-source Windows service manager. - Use
nssm
to install the Nacos service:nssm install NacosServer "C:\path\to\nacos\bin\startup.cmd"
Method 3: Using PowerShell Script
We can use a PowerShell script to start Nacos and deploy it as a service.
Steps
- Download and extract the Nacos package.
- Create a PowerShell script
start-nacos.ps1
with the following content:Start-Process -FilePath "C:\path\to\nacos\bin\startup.cmd"
- Use
sc.exe
to create a service and set it to start automatically:sc.exe create NacosService binPath= "powershell.exe -File C:\path\to\start-nacos.ps1" sc.exe config NacosService start= auto sc.exe start NacosService
Method 4: Using Task Scheduler
We can use Windows Task Scheduler to schedule Nacos to start.
Steps
- Download and extract the Nacos package.
- Open Task Scheduler and create a new task.
- In the Actions tab, add a new action to start
startup.cmd
and set the trigger conditions and execution time.