安装jdk1.8
链接:https://pan.baidu.com/s/1_P7jHzH4Lk2jcPWWD7pi4w
提取码:6kkm
winscp软件上传压缩包到Linux中
解压
powershell
# 解压到/usr/local/java目录下
tar -zxvf jdk-8u381-linux-x64.tar.gz -C /usr/local/java
配置环境变量
vi /etc/profile
powershell
# 最后一行添加
# JAVA_HOME的值改为自己的
export JAVA_HOME=/usr/local/java/jdk1.8.0_381
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
# 刷新
source /etc/profile
java -version
通过wget安装maven
bash
wget https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz --no-check-certificate
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7\&arch=x86_64\&repo=os\&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; 未知的错误"
cd /etc/sysconfig/network-scripts
vi ifcfg-ens33
配置DNS1和网关一样的值
GATEWAY=192.168.74.2
DNS1=192.168.74.2
坑:ipaddr的最后一个值必须在50-150之间随机选一个,否则会ping不通百度
解压压缩包:
bash
tar -zxvf apache-maven-3.6.1-bin.tar.gz
配置本地仓库和阿里云镜像
powershell
cd apache-maven-3.6.1
# 创建仓库文件夹
mkdir repo
[root@localhost repo]# pwd
/env/apache-maven-3.6.1/repo #复制这个路径,下面配置仓库地址需要填写
修改配置文件
powershell
cd ../
vi conf/settings.xml
填写:
/env/apache-maven-3.6.1/repo
bash
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
:wq!
退出保存
配置环境变量
powershell
vi /etc/profile
powershell
export MAVEN_HOME=/usr/local/apache-maven-3.6.1
export PATH=$MAVEN_HOME/bin:$PATH
注意每次修改环境变量都要刷新配置文件
powershell
source /etc/profile
检查是否安装配置成功
mvn -v