1. Preparation before installation
1. Download nacos-server-2.2.3 binary package
wget https://github.com/alibaba/nacos/releases/download/2.2.3/nacos-server-2.2.3.tar.gz
2. Install JDK environment (1.8 and above)
1) Use the following command to install jdk on the ubuntu system (jdk>jre>jvm, be careful to select jdk, because javac is required for startup)
apt-get install openjdk-18-jdk-headless
2) Use java -version to check the version of installed java
3) View the installed jdk directory
readlink -f /usr/bin/java | sed "s:bin/java::"
4) Configure user environment variables
echo 'JAVA_HOME=/usr/lib/jvm/java-18-openjdk-amd64' >> ~/.bashrc
source ~/.bashrc
2. Start installing Nacos
1. Download the binary file to the directory
cd /wechat
wget https://github.com/alibaba/nacos/releases/download/2.2.3/nacos-server-2.2.3.tar.gz
2. Unzip the binary package
tar -xvf nacos-server-2.2.3.tar.gz
3. Modify the decompressed nacos directory to the versioned directory nacos-2.2.3 and start nacos.
mv/wechat/nacos /wechat/nacos-2.2.3 ./bin/startup.sh -m standalone
4. Use the database to configure the Nacos environment
1) Execute mysql-schema.sql in the configuration directory conf in the application database
2) Modify the Nacos configuration file and add database configuration to application.properties under conf
spring.datasource.plateform=mysql db.num=1 db.url.0=jdbc:mysql://数据库IP:3306/app_broker?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=appCreator db.password.0=数据库密码 db.pool.config.connectionTimeout=30000 db.pool.config.validationTimeout=10000 db.pool.config.maximumPoolSize=20 db.pool.config.minimumIdle=2
3) Restart the Nacos service
cd /wechat/nacos-2.2.3/bin ./shutdown.sh ./startup.sh -m standalone
If the following content appears, the startup is successful. You can use ps -ef|grep nacos to check whether the process exists.
4) Access the Nacos management terminal through a browser. User authentication is not enabled by default and can be operated without logging in.
http://IP:8848/nacos/index.html
3. Turn on the user verification function when Nacos starts
1. Modify the application.properties file under conf, add and modify the following parameter configurations
nacos.core.auth.system.type=nacos #The default value of turning on user authentication switch is false. This time it needs to be changed to true nacos.core.auth.enabled=true nacos.core.auth.caching.enabled=true nacos.core. auth.enable.userAgentAuthWhite=false #Set the user authentication identity nacos.core.auth.server.identity.key=example nacos.core.auth.server.identity.value=example nacos.core.auth.plugin.nacos.token. cache.enable=false nacos.core.auth.plugin.nacos.token.expire.seconds=18000 #Set encryption key nacos.core.auth.plugin.nacos.token.secret.key=VGhpc0lzTXlDdXN0b21TZWNyZXRLZXkwMTIzNDU2Nzg=
2. Restart and use the nacos user to log in to the following link (the default password is nacos)
http://IP:8848/nacos/index.html