由于考虑使用nacos python sdk,目前该sdk支持最新版本为nacos 1.3.2,安装nacos 1.3.2 版本
下载nacos 1.3.2 tar 包
Release 1.3.2(Aug 4, 2020) · alibaba/nacos · GitHub
在centos根目录创建app目录
将下载好的nacos安装包上传至app目录,解压tar包
[root@localhost bin]# tar -zxvf nacos-server-1.3.2.tar.gz
切换至/app/nacos/bin,执行
[root@localhost bin]# sh startup.sh -m standalone
报错,提示没有安装java
Please set the JAVA_HOME variable in your environment, We need java(x64)! jdk8 or later is better! !
安装java
通过yum,安装openjdk
[root@localhost bin]# yum install -y java-1.8.0-openjdk*
java --version确认java是否安装成功
查看java安装路径
[root@localhost bin]# ls -l /usr/lib/jvm
total 0
lrwxrwxrwx. 1 root root 26 Jan 10 15:55 java -> /etc/alternatives/java_sdk
lrwxrwxrwx. 1 root root 32 Jan 10 15:55 java-1.8.0 -> /etc/alternatives/java_sdk_1.8.0
lrwxrwxrwx. 1 root root 40 Jan 10 15:56 java-1.8.0-openjdk -> /etc/alternatives/java_sdk_1.8.0_openjdk
drwxr-xr-x. 9 root root 176 Jan 10 15:56 java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
lrwxrwxrwx. 1 root root 34 Jan 10 15:55 java-openjdk -> /etc/alternatives/java_sdk_openjdk
lrwxrwxrwx. 1 root root 21 Jan 10 15:55 jre -> /etc/alternatives/jre
lrwxrwxrwx. 1 root root 27 Jan 10 15:55 jre-1.8.0 -> /etc/alternatives/jre_1.8.0
lrwxrwxrwx. 1 root root 35 Jan 10 15:55 jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk
lrwxrwxrwx. 1 root root 51 Jan 10 15:55 jre-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64 -> java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre
lrwxrwxrwx. 1 root root 29 Jan 10 15:55 jre-openjdk -> /etc/alternatives/jre_openjdk
在/etc/profile文件中添加如下内容
# java environment
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA HOME CLASSPATH PATH
保存关闭profile文件,执行如下命令使配置文件生效
[root@localhost bin]# source /etc/profile
[root@localhost bin]# echo $JAVA_HOME
[root@localhost bin]# echo $PATH
[root@localhost bin]# echo $CLASSPATH
查看JDK变量
切换至/app/nacos/bin,执行
[root@localhost bin]# sh startup.sh -m standalone
[root@localhost bin]# sh startup.sh -m standalone
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/lib/ext -Xloggc:/app/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/app/nacos/plugins/health,/app/nacos/plugins/cmdb -Dnacos.home=/app/nacos -jar /app/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/app/nacos/conf/ --logging.config=/app/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
nacos is starting with standalone
nacos is starting,you can check the /app/nacos/logs/start.out
查看日志,确认nacos启动成功
[root@localhost bin]# cat /app/nacos/logs/start.out
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-1.el7_9.x86_64/lib/ext -Xloggc:/app/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/app/nacos/plugins/health,/app/nacos/plugins/cmdb -Dnacos.home=/app/nacos -jar /app/nacos/target/nacos-server.jar --spring.config.location=classpath:/,classpath:/config/,file:./,file:./config/,file:/app/nacos/conf/ --logging.config=/app/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288
,--.
,--.'|
,--,: : | Nacos 1.3.2
,`--.'`| ' : ,---. Running in stand alone mode, All function modules
| : : | | ' ,' .--.--. Port: 8848
: | | : ,--.--. ,---. / / | / / ' Pid: 1803
| : ' '; | / / . ; ,. :| : /`./ Console: http://192.168.1.129:8848/nacos/index.html
' ' ;. ;.--. .-. | / / '' | |: :| : ;_
| | | | __/: . .. ' / ' | .; : `. https://nacos.io
' : | ; .' ," .--.; |' ; :__| : | `----.
| | '`--' / / ,. |' | '.'| / / /`--' /
' : | ; : .' : : `----' '--'. /
; |.' | , .-./ / `--'---'
'---' `--`---' `----'
2022-01-10 16:08:52,568 INFO Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$70970bc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-01-10 16:08:52,787 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)
2022-01-10 16:08:52,790 INFO Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@4e31276e' 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-01-10 16:08:52,811 INFO Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$2bde136e] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-01-10 16:08:52,815 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-01-10 16:08:53,714 INFO Tomcat initialized with port(s): 8848 (http)
2022-01-10 16:08:53,980 INFO Root WebApplicationContext: initialization completed in 6013 ms
2022-01-10 16:09:00,808 INFO Initializing ExecutorService 'applicationTaskExecutor'
2022-01-10 16:09:01,185 INFO Adding welcome page: class path resource [static/index.html]
2022-01-10 16:09:01,954 INFO Creating filter chain: Ant [pattern='/**'], []
2022-01-10 16:09:02,019 INFO Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@388ffbc2, org.springframework.security.web.context.SecurityContextPersistenceFilter@7a56812e, org.springframework.security.web.header.HeaderWriterFilter@459f7aa3, org.springframework.security.web.csrf.CsrfFilter@307765b4, org.springframework.security.web.authentication.logout.LogoutFilter@6de54b40, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@7eb01b12, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7e70bd39, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@a50b09c, org.springframework.security.web.session.SessionManagementFilter@7db534f2, org.springframework.security.web.access.ExceptionTranslationFilter@2c95ac9e]
2022-01-10 16:09:02,200 INFO Exposing 2 endpoint(s) beneath base path '/actuator'
2022-01-10 16:09:02,280 INFO Initializing ExecutorService 'taskScheduler'
2022-01-10 16:09:02,614 INFO Tomcat started on port(s): 8848 (http) with context path '/nacos'
2022-01-10 16:09:02,642 INFO Nacos Log files: /app/nacos/logs
2022-01-10 16:09:02,644 INFO Nacos Log files: /app/nacos/conf
2022-01-10 16:09:02,645 INFO Nacos Log files: /app/nacos/data
2022-01-10 16:09:02,645 INFO Nacos started successfully in stand alone mode. use embedded storage
通过访问http://localhost:8848/nacos/index.html
localhost为安装nacos服务器的地址,若不在本机则需要进行替换
用户名密码均为nacos,可以实现正常登录
若发现网页无法打开,可能是centos防火墙没有关闭,关闭方法如下:
[root@localhost bin]# systemctl stop firewalld.service
[root@localhost bin]# systemctl disable firewalld.service



