linux安装nacos
一、下载nacos安装包
nacos-server-1.3.1.tar.gz
提取码:xu7s
nacos-server-1.3.1.zip
提取码:0h9z
二、上传安装包,解压安装包
当时不太懂,这两个有什么区别,解压后你就知道,其实没区别,就是一个springboot项目,无论哪个,上传解压就行了;
进入到存放nacos-server-1.3.1.tar.gz压缩包目录,解压命令如下
tar -zxvf nacos-server-1.3.1.tar.gz
执行该命令,会解压nacos-server-1.3.1.tar.gz到该压缩包同级目录,文件夹名nacos;
移动文件到指定位置,先进入到存放该文件的目录;
mv nacos /usr/local
三、启动nacos
执行完毕,我们就可以启动nacos了,进入nacos文件的bin目录下,再执行启动;
[root@VM-0-2-centos nacos]# cd bin/
[root@VM-0-2-centos bin]# ll
total 20
-rwxr-xr-x 1 502 games 954 May 14 10:03 shutdown.cmd
-rwxr-xr-x 1 502 games 949 Jul 3 18:25 shutdown.sh
-rwxr-xr-x 1 502 games 3089 Jul 10 17:27 startup.cmd
-rwxr-xr-x 1 502 games 5026 Jul 10 17:27 startup.sh
[root@VM-0-2-centos bin]# sh startup.sh -m standalone
/usr/local/soft/jdk1.8.0_221/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/local/soft/jdk1.8.0_221/jre/lib/ext:/usr/local/soft/jdk1.8.0_221/lib/ext -Xloggc:/usr/local/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/usr/local/nacos/plugins/health,/usr/local/nacos/plugins/cmdb -Dnacos.home=/usr/local/nacos -jar /usr/local/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/usr/local/nacos/conf/ --logging.config=/usr/local/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with standalone
nacos is starting,you can check the /usr/local/nacos/logs/start.out
四、查看启动日志
日志地址在:/usr/local/nacos/logs/start.out里,我是直接打开看的;
/usr/local/soft/jdk1.8.0_221/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/local/soft/jdk1.8.0_221/jre/lib/ext:/usr/local/soft/jdk1.8.0_221/lib/ext -Xloggc:/usr/local/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/usr/local/nacos/plugins/health,/usr/local/nacos/plugins/cmdb -Dnacos.home=/usr/local/nacos -jar /usr/local/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/usr/local/nacos/conf/ --logging.config=/usr/local/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
,--.
,--.'|
,--,: : | Nacos 1.3.1
,`--.'`| ' : ,---. Running in stand alone mode, All function modules
| : : | | ' ,'\ .--.--. Port: 8848
: | \ | : ,--.--. ,---. / / | / / ' Pid: 30423
| : ' '; | / \ / \. ; ,. :| : /`./ Console: http://172.21.0.2:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | \ | \__\/: . .. ' / ' | .; : \ \ `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----. \
| | '`--' / / ,. |' | '.'|\ \ / / /`--' /
' : | ; : .' \ : : `----' '--'. /
; |.' | , .-./\ \ / `--'---'
'---' `--`---' `----'
2020-08-04 14:10:47,280 INFO Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$73c81413] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-08-04 14:10:47,457 INFO Bean 'objectPostProcessor' of type [org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-08-04 14:10:47,460 INFO Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@1a72a540' 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)
2020-08-04 14:10:47,463 INFO Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$989cb6c5] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-08-04 14:10:47,485 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)
2020-08-04 14:10:48,551 INFO Tomcat initialized with port(s): 8848 (http)
2020-08-04 14:10:48,896 INFO Root WebApplicationContext: initialization completed in 6592 ms
2020-08-04 14:10:56,883 INFO Initializing ExecutorService 'applicationTaskExecutor'
2020-08-04 14:10:57,257 INFO Adding welcome page: class path resource [static/index.html]
2020-08-04 14:10:57,978 INFO Creating filter chain: Ant [pattern='/**'], []
2020-08-04 14:10:58,063 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@6cea706c, org.springframework.security.web.context.SecurityContextPersistenceFilter@2a2da905, org.springframework.security.web.header.HeaderWriterFilter@6063d80a, org.springframework.security.web.csrf.CsrfFilter@59fc684e, org.springframework.security.web.authentication.logout.LogoutFilter@1b11ef33, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@60cf80e7, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@48c40605, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3bd7f8dc, org.springframework.security.web.session.SessionManagementFilter@355e34c7, org.springframework.security.web.access.ExceptionTranslationFilter@2fd1731c]
2020-08-04 14:10:58,258 INFO Exposing 2 endpoint(s) beneath base path '/actuator'
2020-08-04 14:10:58,328 INFO Initializing ExecutorService 'taskScheduler'
2020-08-04 14:10:58,653 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'
2020-08-04 14:10:58,656 INFO Nacos Log files: /usr/local/nacos/logs
2020-08-04 14:10:58,669 INFO Nacos Log files: /usr/local/nacos/conf
2020-08-04 14:10:58,669 INFO Nacos Log files: /usr/local/nacos/data
2020-08-04 14:10:58,670 INFO Nacos started successfully in stand alone mode. use embedded storage
2020-08-04 14:13:54,643 INFO Initializing Servlet 'dispatcherServlet'
2020-08-04 14:13:54,657 INFO Completed initialization in 14 ms
这样就算是启动完成了,没有报错;如果大家在启动报错,请根据各自问题解决;
五、访问nacos
回到本地,通过浏览器访问nacos;
访问地址:http://服务器ip:8848/nacos/index.html
如果成功打开如下页面,就可以了,如果拒绝访问,请检查各自服务器的8848端口是否开放;如果不知道怎么开放,我在Linux安装Tomcat教程解析文章中提到了如何开放端口。