Download Locations
Official NATS Server binaries are available from:- GitHub Releases: github.com/nats-io/nats-server/releases
- Official Website: nats.io/download
Latest Version
Download the latest stable release:Replace
v2.10.0 with the actual latest version number from the releases page.Platform-Specific Installation
Linux
Quick Installation
Manual Installation
Package Managers
macOS
Homebrew (Recommended)
Manual Installation
Windows
Manual Installation
- Download the Windows ZIP from GitHub Releases
- Extract the ZIP file
- Move
nats-server.exeto a directory in your PATH (e.g.,C:\Windows\System32) - Verify installation:
Chocolatey
Scoop
Running NATS Server
Basic Usage
Start NATS with default settings:- Listen on port 4222 for client connections
- Listen on 0.0.0.0 (all interfaces)
- Run in the foreground
With Configuration File
Command Line Options
-p, --port- Client connection port (default: 4222)-a, --addr- Network address to bind (default: 0.0.0.0)-m, --http_port- HTTP monitoring port-c, --config- Configuration file path-l, --log- Log file path-D, --debug- Enable debug logging-V, --trace- Enable trace logging-js- Enable JetStream--sd- JetStream storage directory
Enable JetStream
Running as a Service
systemd (Linux)
Create a systemd service file:/etc/systemd/system/nats-server.service
launchd (macOS)
Create a launch agent:~/Library/LaunchAgents/io.nats.nats-server.plist
Windows Service
Use NSSM (Non-Sucking Service Manager):Updating and Upgrading
Manual Update
- Download the new version
- Stop the running server
- Replace the binary
- Restart the server
Package Manager Updates
Zero-Downtime Updates
For clustered deployments, update nodes one at a time:Verifying Installation
Check Version
Test Configuration
-t flag validates configuration without starting the server.
Test Connection
Security Considerations
File Permissions
Firewall Rules
Allow necessary ports:Best Practices
Use Configuration Files
Store configuration in files rather than using command-line flags for better maintainability.
Run as Service
Use systemd, launchd, or Windows services for automatic restarts and proper lifecycle management.
Regular Updates
Keep NATS Server updated to benefit from security patches and new features.
Monitor Logs
Configure proper logging and monitor logs for errors and performance issues.
Troubleshooting
Binary Not Found
Ensure the binary is in your PATH:Permission Denied
Port Already in Use
Check what’s using port 4222:Service Won’t Start
Check service logs:Next Steps
Configuration
Learn about configuration options and best practices
Docker Deployment
Explore containerized deployment options