新建存放jdk&maven压缩包目录
mkdir -p /usr/local/java
mkdir -p /usr/local/maven
下载jdk8压缩包&maven压缩包
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
wget http://mirror.bit.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz
解压缩
tar -zxvf jdk-8u141-linux-x64.tar.gz
tar -zxvf apache-maven-3.6.3-bin.tar.gz
配置环境变量
vi /etc/profile
export JAVA_HOME=/usr/local/java/jdk1.8.0_141
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export MAVEN_HOME=/usr/local/maven/apache-maven-3.6.3
export PATH=$PATH:$MAVEN_HOME/bin
刷新环境变量文件
source /etc/profile
验证
java -version
mvn -version