Nacos Quick Start
This Quick Start Guide helps you quickly download, install, and use Nacos on your computer.
0. Version Selection
You can find the features supported by each version through Nacos’s version download page, release notes, and release announcements. The currently recommended stable version for production environments is 3.1.1.
1. Prerequisites
Nacos relies on a Java environment to run. Please ensure you have the following environment set up:
- 64-bit OS, supporting Linux/Unix/Mac/Windows. Linux/Unix/Mac is recommended.
- 64-bit JDK 17+; Download & Configure.
2. Download and Start Nacos
2.1. One-Click Deployment with nacos-setup (Recommended)
nacos-setup provides one-click automated deployment, automatically handling download, authentication configuration, port detection, and Java environment verification.
Install nacos-setup:
curl -fsSL https://nacos.io/nacos-installer.sh | sudo bash
powershell -NoProfile -ExecutionPolicy Bypass -Command "iwr -UseBasicParsing https://nacos.io/nacos-installer.ps1 | iex"
Start Nacos:
# One-click deploy the latest standalone Nacosnacos-setup
# One-click deploy a specific version of standalone Nacosnacos-setup -v 3.1.1
# One-click deploy the latest Nacos clusternacos-setup -c cluster
# Configure external storage globally, enter database address, port, username and password, then re-run nacos-setupnacos-setup --datasource-confFor more usage, please refer to One-Click Deployment with nacos-setup.
2.2. Manual Download and Deployment
2.2.1. Download the Package
You can obtain the Nacos distribution package through the Nacos official website or Github.
Go to the Nacos official version download page, select a stable version, and click ${nacos.version}.zip in the Binary Package Download column to download.
Note: When many users are downloading simultaneously, you may encounter download rate limiting. If this happens, please wait and try again, or use the
Github download method.
Go to the Nacos Github latest stable release, select the desired Nacos version, and click to download the nacos-server-$version.zip package from Assets.
2.2.2. Extract the Nacos Distribution Package
unzip nacos-server-$version.zip # or tar -xvf nacos-server-$version.tar.gz cd nacos/bin2.2.3. Start the Server
- Note: Nacos is recommended to run on machines with at least 2 CPU cores, 4GB RAM, and 60GB disk space.
Start command (standalone means running in standalone mode, not cluster mode):
sh startup.sh -m standalone
If you are using Ubuntu, or the script reports an error about the [[ symbol not found, try running: bash startup.sh -m standalone
Start command (standalone means running in standalone mode, not cluster mode):
startup.cmd -m standalone
The startup program will then prompt you to enter 3 authentication-related configurations (since Nacos 3.0.0, console authentication is enabled by default, so the following 3 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.plugin.nacos.token.secret.key` Updated:----------------------------------`nacos.core.auth.server.identity.key` is missing, please set: ${your_input_server_identity_key}`nacos.core.auth.server.identity.key` Updated:----------------------------------`nacos.core.auth.server.identity.value` is missing, please set: ${your_input_server_identity_key}`nacos.core.auth.server.identity.value` Updated:----------------------------------3. Verify Nacos Service Started Successfully
Navigate to the ${nacos.home}/logs/ directory and use tail -f start.out to view the logs. If you see the following log, the service has started successfully.
Nacos started successfully in stand alone mode. use embedded storageYou can use the following services to quickly verify Nacos functionality.
3.1. Nacos Console Page
Open any browser and enter the address: http://127.0.0.1:8080/index.html to access the Nacos console page.
Note: The first time you open it, you will be asked to initialize the password for the admin user
nacos.
3.2. 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'
3.3. Service Discovery
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/ns/instance/list?serviceName=quickstart.test.service'
3.4. Publish Configuration
# Login to obtain access tokencurl -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 configurationcurl -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}"3.5. Get Configuration
curl -X GET 'http://127.0.0.1:8848/nacos/v3/client/cs/config?dataId=quickstart.test.config&groupName=test'
4. Shutdown Server
4.1. Linux/Unix/Mac
sh shutdown.sh
4.2. Windows
shutdown.cmd
Or double-click the shutdown.cmd file to run it.