静态IP设置
# 修改网卡配置文件
vim /etc/sysconfig/network-scripts/ifcfg-ens33# 修改文件内容
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
IPADDR=192.168.18.130
NETMASK=255.255.255.0
GATEWAY=192.168.18.2
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2c2371f1-ef29-4514-a568-c4904bd11130
DEVICE=ens33
ONBOOT=yes
DNS1=114.114.114.114# 重启网络
systemctl restart network
切换YUM源
cp -r /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
sudo sed -i.bak \-e 's|^mirrorlist=|#mirrorlist=|g' \-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos-vault/centos|g' \/etc/yum.repos.d/CentOS-Base.repo
yum -y install vim wget net-tools
Java8环境配置[CentOS7]
cd /usr/local/src
wget https://repo.huaweicloud.com/java/jdk/8u201-b09/jdk-8u201-linux-x64.tar.gztar -xzvf jdk-8u201-linux-x64.tar.gz -C /usr/local#配置环境变量
vim /etc/profile
#文末添加
export JAVA_HOME=/usr/local/jdk1.8.0_201
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATHsource /etc/profile
java -version
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
GIT内网部署[CentOS7]
yum -y install gcc automake autoconf libtool make curl-devel expat-devel openssl-develcd /usr/local/src
wget --no-check-certificate https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.24.1.tar.gztar -xzvf git-2.24.1.tar.gz -C /usr/local/src/cd /usr/local/src/git-2.24.1
make prefix=/usr/local/git-2.24.1 all
make prefix=/usr/local/git-2.24.1 installvim /etc/profile
export PATH=$PATH:/usr/local/git-2.24.1/bin
source /etc/profilegit --version
git version 2.24.1
MySQL安装[CentOS7]
cd /usr/local/src
wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.sh dbMySQL 5.7.26# 开放端口 or 禁用防火墙
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --zone=public --add-port=3306/udp --permanent
systemctl disable firewalld.servicemysql -uroot -p
mysql> use mysql
Database changed
mysql> update user set host = '%' where user = 'root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
Maven 3.9.3 内网部署[CentOS7]
cd /usr/local/src
wget --no-check-certificate https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gztar -xzvf apache-maven-3.9.9-bin.tar.gz -C /usr/local/
<!-- 修改maven远程仓库配置,修改maven本地仓库地址 -->
<!-- /usr/local/apache-maven-3.9.9/conf/settings.xml -->
<mirrors><mirror><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url><mirrorOf>central</mirrorOf> </mirror><mirror><id>nexus-tencentyun</id><mirrorOf>*</mirrorOf><name>Nexus tencentyun</name><url>http://mirrors.cloud.tencent.com/nexus/repository/maven-public/</url></mirror>
</mirrors><localRepository>/usr/local/apache-maven-3.9.9/repo</localRepository>
vim /etc/profileexport MAVEN_HOME=/usr/local/apache-maven-3.9.9
export PATH=${PATH}:${MAVEN_HOME}/binsource /etc/profile# 校验是否安装成功
mvn -version
Node 14.20.0 安装[CentOS7]
cd /usr/local/src
wget --no-check-certificate https://npm.taobao.org/mirrors/node/v14.20.0/node-v14.20.0-linux-x64.tar.gztar -xzvf node-v14.20.0-linux-x64.tar.gz -C /usr/local
mv /usr/local/node-v14.20.0-linux-x64 /usr/local/node-v14.20.0vim /etc/profile
export NODE_HOME=/usr/local/node-v14.20.0
export PATH=$NODE_HOME/bin:$PATHsource /etc/profilenpm install -g cnpm --registry=https://registry.npm.taobao.org### 检验是否安装成功
node -v
v14.20.0
npm -v
6.14.17
Redis 7.90.11 安装 [CentOS7]
# 安装
cd /usr/local/src/
wget https://mirrors.huaweicloud.com/redis/redis-7.0.11.tar.gz# 编译安装
tar -xzvf /usr/local/src/redis-7.0.11.tar.gz -C /usr/local/src/
cd /usr/local/src/redis-7.0.11
make PREFIX=/usr/local/redis-7.0.11 install
cat /usr/local/src/redis-7.0.11/redis.conf | grep '#|^$' -vE >> /usr/local/redis-7.0.11/redis-standalone-15030.confvim /usr/local/redis-7.0.11/redis-standalone-15030.conf
# 配置参数
bind 192.168.18.130
protected-mode no
port 15030
daemonize yes
pidfile /usr/local/redis-7.0.11/log/redis_15030.pid
logfile "/usr/local/redis-7.0.11/log/redis_15030.log"# 持久化文件存放目录
dir ./
# 编写启动脚本
mkdir -p /usr/local/redis-7.0.11/log/
cd /usr/local/redis-7.0.11/
vim start-redis-standalone.sh#!/bin/bash
cd bin/
./redis-server ../redis-standalone-15030.conf
sh start-redis-standalone.sh
Nacos2.2.4内网部署[CentOS7]
cd /usr/local/src
git clone https://gitee.com/mirrors/Nacos.gitcd Nacos
git checkout 2.2.4
mvn -Prelease-nacos -Dmaven.test.skip=true clean install -U cp -r /usr/local/src/Nacos/distribution/target/nacos-server-2.2.4/nacos /usr/local/cd /usr/local/nacos
- nacos- conf- nacos-mysql.sql- application.properties# 在MySQL中新建nacos库并导入nacos-mysql.sql脚本
# 修改application.properties中如下参数
spring.datasource.platform=mysql
spring.sql.init.platform=mysql
db.num=1
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=rootnacos.core.auth.system.type=nacos
nacos.core.auth.enabled=true
nacos.core.auth.server.identity.key=nacos
nacos.core.auth.server.identity.value==nacos
### The default token (Base64 String): F1CEA7FFC3884B9694FBF0BF0D1525D62AAEDD3825A14D438E9C57DB30BE8E61
nacos.core.auth.plugin.nacos.token.secret.key=RjFDRUE3RkZDMzg4NEI5Njk0RkJGMEJGMEQxNTI1RDYyQUFFREQzODI1QTE0RDQzOEU5QzU3REIzMEJFOEU2MQ===cd /usr/local/nacos/bin
sh startup.sh -m standalone
配置文件变更
# Tomcat
server:port:
# Spring
spring:application:# 应用名称name: profiles:# 环境配置active: devcloud:nacos:# Nacos 认证用户username: nacos# Nacos 认证密码password: nacosconfig:# 是否开启配置中心 默认true。本地的话可以关闭 falseenabled: true# 配置中心地址server-addr: 192.168.18.130:8848# 配置文件后缀file-extension: yml# 配置对应的分组group: DEFAULT_GROUP# 命名空间 常用场景之一是不同环境的配置的区分隔离,例如开发测试环境和生产环境的资源(如配置、服务)隔离等namespace: ${spring.profiles.active}prefix: ${spring.application.name}# 共享配置shared-configs:- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}discovery:server-addr: ${spring.cloud.nacos.config.server-addr}namespace: ${spring.profiles.active}
将ry_config.config_info表中配置文件写入nacos中
重启前后端服务