Linux安装Nacos

一、下载Nacos(快速下载链接:nacos免费

二、上传至服务器(工具:finalshell),我放的路径为/opt

tar -zxvf nacos-server-1.4.2.tar.gz

# 查看java位置,复制备用
which java
/usr/local/jdk-11/bin/java

# 进入解压后的nacos文件目录下,进入到bin目录下
cd /opt/nacos/bin

# 编辑 vim startup.sh脚本,修改javahome
vim startup.sh


三、执行nacos自带的sql文件
创建数据库,数据库脚本在源码包有,在 nacos/conf/nacos-mysql.sql,把这个导入到数据库中执行后会生成表。
四、编辑 application.properties 修改如下

# 修改配置文件
cd /opt/nacos/conf
vim application.properties

 五、单机启动

# 进入 
cd /opt/nacos/bin 
# 执行./startup.sh -m standalone
[root@master bin]# ./startup.sh -m standalone
/usr/local/jdk-11/bin/java  -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/opt/nacos/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/opt/nacos/nacos/plugins/health,/opt/nacos/nacos/plugins/cmdb -Dnacos.home=/opt/nacos/nacos -jar /opt/nacos/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/opt/nacos/nacos/conf/ --logging.config=/opt/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with standalone
nacos is starting,you can check the /opt/nacos/nacos/logs/start.out

六、查看日志(cat /opt/nacos/logs/start.out)
可以看见下面的日志中,内网地址:http://localhost:8848/nacos/index.html

七、默认用户和密码一样:nacos(没关防火墙去关防火墙)

[root@master bin]# cat /opt/nacos/nacos/logs/start.out
/usr/local/jdk-11/bin/java  -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Xlog:gc*:file=/opt/nacos/nacos/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400 -Dloader.path=/opt/nacos/nacos/plugins/health,/opt/nacos/nacos/plugins/cmdb -Dnacos.home=/opt/nacos/nacos -jar /opt/nacos/nacos/target/nacos-server.jar  --spring.config.additional-location=file:/opt/nacos/nacos/conf/ --logging.config=/opt/nacos/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288

         ,--.
       ,--.'|
   ,--,:  : |                                           Nacos 1.4.2
,`--.'`|  ' :                       ,---.               Running in stand alone mode, All function modules
|   :  :  | |                      '   ,'\   .--.--.    Port: 8848
:   |   \ | :  ,--.--.     ,---.  /   /   | /  /    '   Pid: 4575
|   : '  '; | /       \   /     \.   ; ,. :|  :  /`./   Console: http://localhost:8848/nacos/index.html
'   ' ;.    ;.--.  .-. | /    / ''   | |: :|  :  ;_
|   | | \   | \__\/: . ..    ' / '   | .; : \  \    `.      https://nacos.io
'   : |  ; .' ," .--.; |'   ; :__|   :    |  `----.   \
|   | '`--'  /  /  ,.  |'   | '.'|\   \  /  /  /`--'  /
'   : |     ;  :   .'   \   :    : `----'  '--'.     /
;   |.'     |  ,     .-./\   \  /            `--'---'
'---'        `--`---'     `----'

2022-09-14 17:38:28,648 INFO Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@73386d72' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2022-09-14 17:38:28,651 INFO Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

2022-09-14 17:38:28,973 INFO Tomcat initialized with port(s): 8848 (http)

2022-09-14 17:38:29,288 INFO Root WebApplicationContext: initialization completed in 2967 ms

2022-09-14 17:38:30,951 INFO Initializing ExecutorService 'applicationTaskExecutor'

2022-09-14 17:38:31,072 INFO Adding welcome page: class path resource [static/index.html]

2022-09-14 17:38:31,328 INFO Creating filter chain: Ant [pattern='/**'], []

2022-09-14 17:38:31,351 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@20580d4e, org.springframework.security.web.context.SecurityContextPersistenceFilter@3fa21d49, org.springframework.security.web.header.HeaderWriterFilter@91f565d, org.springframework.security.web.csrf.CsrfFilter@4ed5a1b0, org.springframework.security.web.authentication.logout.LogoutFilter@57e388c3, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6e31d989, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@65bb6275, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@21bd128b, org.springframework.security.web.session.SessionManagementFilter@3cd26422, org.springframework.security.web.access.ExceptionTranslationFilter@67b355c8]

2022-09-14 17:38:31,413 INFO Initializing ExecutorService 'taskScheduler'

2022-09-14 17:38:31,430 INFO Exposing 2 endpoint(s) beneath base path '/actuator'

2022-09-14 17:38:31,523 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'

2022-09-14 17:38:31,526 INFO Nacos started successfully in stand alone mode. use external storage


单机部署完成
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Linux安装Nacos,首先需要安装JDK和Maven,并配置好环境变量。然后按照以下步骤进行操作: 1. 下载NacosLinux版本压缩包(nacos-server-1.1.4.tar.gz),并将其上传到Linux服务器上的/opt目录中。 2. 解压缩Nacos压缩包,可以使用以下命令: ``` tar -zxvf nacos-server-1.1.4.tar.gz ``` 3. 配置MySQL数据库,确保Linux服务器上已经正确安装并配置好MySQL。 4. 配置Nacos的application.properties文件,该文件位于解压后的Nacos目录的conf文件夹中。根据你的MySQL配置,修改以下参数: ``` spring.datasource.platform=mysql db.num=1 db.url.0=jdbc:mysql://localhost:3306/nacos?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true db.user=root db.password=root ``` 5. 配置Nacos的集群配置cluster.conf,该文件位于解压后的Nacos目录的conf文件夹中。在该文件中添加以下内容: ``` standalone=true ``` 6. 编辑Nacos的启动脚本startup.sh,使其能够接受不同的启动端口。找到以下内容,并修改为所需的端口号: ``` $BASE_DIR/default-mysql.properties ``` 7. 配置Nginx作为负载均衡器,具体配置方式可以参考Nginx官方文档。 8. 启动Nacos服务,进入解压后的Nacos目录的bin文件夹,并执行以下命令: ``` sh startup.sh -m standalone ``` 或者,如果你使用的是Nacos的最新版本,可以进入distribution/bin文件夹,并执行以下命令: ``` sh startup.sh -m standalone ``` 确保Nacos成功启动并运行。 这样,你就成功地在Linux安装Nacos。请根据你的实际情况进行相应的配置和调整。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [linux安装nacos](https://blog.csdn.net/m0_72838865/article/details/127101277)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [在linux安装nacos【非常详细】](https://blog.csdn.net/weixin_45737330/article/details/127493290)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值