Nacos Installation Guide

Environment Requirements

Nacos requires a Java runtime environment. Please ensure you use the following versions:

Nacos is recommended to run with at least the following machine configuration:

  • CPU: 2 cores
  • Memory: 4 GB
  • Disk: 60 GB

Installation Methods

Nacos supports multiple installation methods. You can choose the appropriate method based on your needs.

nacos-setup provides one-click automated deployment, automatically handling download, authentication configuration, port detection, and Java environment verification.

Install nacos-setup

Linux/macOS:

curl -fsSL https://nacos.io/nacos-installer.sh | sudo bash

Windows (PowerShell):

# Execute using PowerShell

Start Nacos Service

Deploy the latest version of standalone Nacos locally:

nacos-setup

Deploy a specific version of standalone Nacos locally:

nacos-setup -v 3.1.1

Deploy the latest version of cluster Nacos locally:

nacos-setup -c cluster

Configure external storage globally, enter database address, port, username, and password, then rerun nacos-setup:

nacos-setup --datasource-conf

For more usage, refer to the nacos-setup user manual.

Method 2: Manual Download and Deployment

Download Installation Package

You can obtain the Nacos distribution package in two ways:

Method 1: Download from Nacos Official Website

Visit the Nacos official website version download page, select a stable version, then click to download the zip file from the binary package column.

Method 2: Download from GitHub

Visit the Nacos GitHub Releases page and download the distribution package for the corresponding version.

Note: When many users download simultaneously, you may encounter download throttling failures. If this happens, wait and retry, or download from GitHub.

Extract Nacos Distribution Package

Linux/Unix/Mac:

unzip nacos-server-$version.zip
# or
tar -xvf nacos-server-$version.tar.gz
cd nacos/bin

Windows:

Use extraction tools to unzip nacos-server-$version.zip directly.

Start Server

Linux/Unix/Mac startup command (standalone means non-cluster mode):

sh startup.sh -m standalone

If you are using Ubuntu, or encounter error messages about symbols not found, try:

bash startup.sh -m standalone

The startup program will prompt you to enter three authentication-related configurations (starting from Nacos 3.0.0, console authentication is enabled by default, so the following three authentication configurations must be filled in):

nacos.core.auth.plugin.nacos.token.secret.key is missing, please set with Base64 string: ${your_input_token_secret_key}
nacos.core.auth.server.identity.key is missing, please set: ${your_input_server_identity_key}
nacos.core.auth.server.identity.value is missing, please set: ${your_input_server_identity_key}

Windows startup command:

cmd startup.cmd

Or double-click startup.cmd to run.

Method 3: Docker Installation

Pull Nacos Image

docker pull nacos/nacos-server

Run Standalone Mode

docker run --name nacos -e MODE=standalone -p 8848:8848 -p 9848:9848 nacos/nacos-server

Run Cluster Mode

Requires cluster deployment with Docker Compose or Kubernetes.

Method 4: Kubernetes Installation

Nacos supports deployment in Kubernetes environments and can be installed using Helm Chart or Operator. For specific steps, refer to the Nacos Kubernetes deployment documentation.

Verify Nacos Service Startup

Navigate to the Nacos logs directory and use tail -f start.out to view logs. If you see the following message, the service has started successfully:

Nacos started successfully in stand alone mode. use embedded storage

Quick Verification

Nacos Console

Open any browser and enter: http://127.0.0.1:8080/index.html to access the Nacos console.

Note: The first time you open it, you will need to initialize the administrator password for user nacos. Default username/password: nacos/nacos@demo.

Service Registration

curl -X POST 'http://127.0.0.1:8848/nacos/v3/client/ns/instance?serviceName=quickstart.test.service&ip=127.0.0.1&port=8080'

Service Discovery

curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'

Publish Configuration

First, log in to get access token:

curl -X POST 'http://127.0.0.1:8848/nacos/v3/auth/user/login' -d 'username=nacos' -d 'password=${your_password}'

Use access token to create configuration:

curl -X POST 'http://127.0.0.1:8848/nacos/v3/admin/cs/config?dataId=quickstart.test.config&groupName=test&content=HelloWorld' -H "accessToken:${your_access_token}"

Get Configuration

curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'

Shutdown Server

Linux/Unix/Mac

sh shutdown.sh

Windows

shutdown.cmd

Or double-click shutdown.cmd to run.

Version Selection

The current recommended stable version for production is 3.1.1. You can learn about features supported by each version from:

  • Nacos version download page
  • Nacos Release Notes
  • Nacos release announcements

Notes

  1. Starting from Nacos 3.0.0, console authentication is enabled by default. Authentication-related parameters must be configured on first startup.
  2. Cluster mode deployment requires external database (such as MySQL) for data storage.
  3. Production environments should use cluster mode to ensure high availability.
  4. Ensure necessary ports are open in firewall (default 8848, 9848).
  5. JDK 17 or higher is recommended for optimal performance.