3

I have up and running NATS server with docker in my windows machine.

I want to install the nats CLI Tool as well in my windows machine.

In the documentation it is only mentioned about Mac and Linux. https://docs.nats.io/running-a-nats-service/clients

3 Answers3

4

I installed the application with Go. Additionally, you can install by running the following command:

'go install github.com/nats-io/natscli/nats@latest'

More information can be found at https://github.com/nats-io/natscli#installation-via-go-install.

satish
  • 2,425
  • 3
  • 23
  • 40
2

Just download nats-0.0.34-windows-amd64.zip from natscli release page and extract nats.exe wherever you want.

Vladislav
  • 1,696
  • 27
  • 37
0
  1. Download Powershell 7.* and install it

  2. Open notepad++ or notepad

  3. Add the lines:

    listen: 192.168.1.121:4223 #replace with your own ip address and port of choice authorization: { token: "your secret token here" #you can remove the whole authorization section if you want no security }

  4. Save the file as nats.config to where the nats-server.exe executable is located

  5. Open notepad++ or notepad again

  6. Paste the following lines

    function Stop-Remove-Nats-Service { param($serviceObject)
    $name = $serviceObject.Name Write-Output("$($name) found") Stop-Service -Name $name Remove-Service -Name $name }

    function Install-Nats-Service{ $currentLocation = "$(Get-Location)\nats-server.exe -c $(Get-Location)\nats.config" New-Service -BinaryPathName $currentLocation -Name "NatsServer" -DisplayName "NATS Server" -StartupType "Automatic" -Description "NATS Streaming Server Service" | Start-Service
    }

    $service = Get-Service -Name "NatsServer"

    if($service -eq $null){ Write-Output "Creating Service" #install if there is nothing Install-Nats-Service }else{
    Write-Output "Removing the existing service." Stop-Remove-Nats-Service $service Write-Output "Ovewriting existing service." Install-Nats-Service }

  7. Save the file as nats-installer.ps1 to where the nats-server.exe is located

  8. Open powershell 7

  9. Navigate to where nats-server.exe is located.

  10. Type .\nats-installer.ps1 (you might see an error at first but just ignore it as it looks for the existing service name and making sure to remove it before installing a new one)

Maico
  • 171
  • 5