Skip to main content
NATS Server is distributed as a single binary with no external dependencies, making installation straightforward on any platform.

System requirements

NATS Server has minimal system requirements and can run on resource-constrained devices including Raspberry Pi.
Minimum requirements:
  • CPU: 1 core (2+ cores recommended for production)
  • Memory: 128 MB RAM (varies based on workload)
  • Disk: 50 MB for binary (additional storage needed for JetStream)
  • OS: Linux, macOS, Windows, or any platform with Go support
Default ports:
  • 4222: Client connections
  • 6222: Cluster routing
  • 8222: HTTP monitoring (when enabled)
  • 5222: Gateway connections (for super-clusters)

Installation methods

Docker is the fastest way to get started with NATS Server.

Pull the official image

The Docker image includes:
  • nats-server - The NATS Server binary
  • nats - The NATS CLI tool
  • nsc - The NATS Security CLI

Run the server

Exposed ports in Docker image

The official Docker image exposes these ports by default:
The default Docker configuration file is located at /nats/conf/nats-server.conf and includes basic settings for client and cluster ports.

Docker Compose example

Post-installation steps

Verify installation

Check that NATS Server is installed correctly:

Start the server

Start NATS Server with default settings:
Common startup options:
The default configuration binds to 0.0.0.0:4222 which accepts connections from any network interface. For production deployments, bind to specific interfaces and enable authentication.

Configuration

Configuration file location

NATS Server looks for configuration files in these locations:
  • Docker: /nats/conf/nats-server.conf
  • Linux: /etc/nats/nats-server.conf (conventional)
  • macOS: /usr/local/etc/nats-server.conf (conventional)
  • Windows: C:\nats\nats-server.conf (conventional)
You can specify a custom location with the -c flag:

Basic configuration example

Create a basic configuration file:
nats-server.conf
Use nats-server -c your-config.conf -t to test your configuration file for syntax errors before starting the server.

Simple configuration example from source

From the NATS Server repository:
simple.conf

Running as a service

Linux (systemd)

Create a systemd service file at /etc/systemd/system/nats-server.service:
Enable and start the service:

macOS (launchd)

Create a plist file at ~/Library/LaunchAgents/io.nats.server.plist:
Load the service:

Command-line reference

Here’s an overview of common command-line options from the source:

Server options

Logging options

JetStream options

Authorization options

TLS options

Cluster options

Next steps

Quickstart

Follow the quickstart guide to send your first message

Configuration

Learn about advanced configuration options

Security

Secure your NATS Server deployment

Monitoring

Set up monitoring and observability