部署jdk和maven
安装jdk
1、源码安装jdk:
tar -xvf jdk-8u91-linux-x64.tar.gz -C /usr/local ln -s /usr/local/jdk1.8.0_91/ /usr/local/java
环境变量
vim /etc/profile JAVA_HOME=/usr/local/java PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME PATH source /etc/profile
验证
# env |grep JAVA JAVA_HOME=/usr/local/java # java -version java version "1.8.0_91" Java(TM) SE Runtime Environment (build 1.8.0_91-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
2、yum安装jdk
列出可安装版本
yum search java 或者 yum list java*
安装jdk
此次选择java-1.8.0-openjdk-devel.x86_64 : OpenJDK Development Environment
yum install java-1.8.0-openjdk-devel.x86_64
配置环境变量
vi /etc/profile export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el6_9.x86_64 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
mac安装jdk
windos10安装jdk8
https://developers.redhat.com/products/openjdk/download
安装maven
下载地址
wget https://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
解压命令
# tar -zxf apache-maven-3.5.4-bin.tar.gz # mv apache-maven-3.5.4 /usr/local/maven
配置环境变量
# vi /etc/profile M2_HOME=/usr/local/maven export PATH=${M2_HOME}/bin:${PATH} source /etc/profile
查看版本
# mvn –v Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00) Maven home: /usr/local/maven Java version: 1.8.0_91, vendor: Oracle Corporation, runtime: /usr/local/jdk1.8.0_91/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-957.el7.x86_64", arch: "amd64", family: "unix"
yum 版安装
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo sudo yum install -y maven # mvn -version Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00)
实例
1、准备编译环境 yum install java-1.8.0-openjdk maven -y 2、编译构建 mvn clean package -D maven.skip.test=true 修改源: vi /etc/maven/settings.xml <mirrors> <mirror> <id>central</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>https://maven.aliyun.com/repository/public</url> </mirror> </mirrors>
https://mp.weixin.qq.com/s/a4PcXjqItFZU3Spgeli_Ng maven的企业级配置
https://www.cnblogs.com/xiaoruilin/p/13175441.html OracleJDK 安装配置
https://www.cnblogs.com/doufy/p/10860633.html oracle jdk和openstack jdk的切换