一、下载安装包
wget https://github.com/alibaba/nacos/releases/download/2.2.3/nacos-server-2.2.3.tar.gz
二、安装
解压安装包
tar -zxvf nacos-server-2.2.3.tar.gz
移动到目录/opt
mv nacos /opt/
配置nacos数据库
mysql> create database nacos;
Query OK, 1 row affected (0.00 sec)mysql> use nacos;
Database changed
mysql> source /opt/nacos/conf/mysql-schema.sql
Query OK, 0 rows affected, 3 warnings (0.01 sec)Query OK, 0 rows affected, 3 warnings (0.01 sec)
Query OK, 0 rows affected, 3 warnings (0.02 sec)
Query OK, 0 rows affected, 3 warnings (0.00 sec)
Query OK, 0 rows affected, 4 warnings (0.02 sec)
Query OK, 0 rows affected, 9 warnings (0.01 sec)
Query OK, 0 rows affected, 4 warnings (0.02 sec)
Query OK, 0 rows affected, 9 warnings (0.01 sec)
Query OK, 0 rows affected, 5 warnings (0.02 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 1 row affected (0.02 sec)
Query OK, 1 row affected (0.00 sec)
修改配置文件/opt/nacos/conf/application.properties
spring.datasource.platform=mysql
spring.sql.init.platform=mysql### Count of DB:
db.num=1### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=root
db.password.0=root
启动服务
/opt/nacos/bin/startup.sh -m standalone
/opt/nacos/logs/start.out日志文件没报错的话说明启动成功
: | \ | : ,--.--. ,---. / / | / / ' Pid: 3575
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://192.168.222.128:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----. \
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
' : | ; : .' \ : : `----' '--'. /
; |.' | , .-./\ \ / `--'---'
'---' `--`---' `----'2023-08-10 07:28:00,143 INFO Tomcat initialized with port(s): 8848 (http)
2023-08-10 07:28:00,233 INFO Root WebApplicationContext: initialization completed in 2376 ms
2023-08-10 07:28:03,159 INFO Adding welcome page: class path resource [static/index.html]
2023-08-10 07:28:03,672 WARN You are asking Spring Security to ignore Ant [pattern='/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
2023-08-10 07:28:03,673 INFO Will not secure Ant [pattern='/**']
2023-08-10 07:28:03,700 INFO Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@40dd3977, org.springframework.security.web.context.SecurityContextPersistenceFilter@674c583e, org.springframework.security.web.header.HeaderWriterFilter@362a019c, org.springframework.security.web.csrf.CsrfFilter@5d5d9e5, org.springframework.security.web.authentication.logout.LogoutFilter@32cb636e, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@3f23a3a0, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@5fb97279, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3a4e343, org.springframework.security.web.session.SessionManagementFilter@5c48c0c0, org.springframework.security.web.access.ExceptionTranslationFilter@4ef27d66]
2023-08-10 07:28:03,729 INFO Exposing 1 endpoint(s) beneath base path '/actuator'
2023-08-10 07:28:03,778 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'
2023-08-10 07:28:03,800 INFO Nacos started successfully in stand alone mode. use external storage
2023-08-10 07:28:14,892 INFO Initializing Servlet 'dispatcherServlet'
2023-08-10 07:28:14,894 INFO Completed initialization in 2 ms
根据日志里的地址可以访问nacos管理界面
http://192.168.222.128:8848/nacos/index.html
停止nacos命令
/opt/nacos/bin/shutdown.sh