linux安装maven及配置环境变量

linux下载maven

  • 下载maven安装包
 wget http://mirrors.cnnic.cn/apache/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz
  • 解压下载好的maven安装包
    解压路径:/usr/local/maven/apache-maven-3.5.2
tar -zxvf apache-maven-3.5.0-bin.tar.gz
  • 配置环境变量
    • vi /etc/profile
 # set Maven environment
export MAVEN_HOME=/usr/local/maven/apache-maven-3.5.2
export PATH=$MAVEN_HOME/bin:$PATH
  • 立即生效
source /etc/profile
  • 验证是否成功
[root@MiWiFi-R3L-srv etc]# mvn -version
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/local/maven/apache-maven-3.5.2
Java version: 1.8.0_111, vendor: Oracle Corporation
Java home: /usr/local/jdk1.8.0_111/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-514.10.2.el7.x86_64", arch: "amd64", family: "unix"

  • 配置镜像仓库
    
    
      nexus-aliyun
      *
      Nexus aliyun
      http:maven.aliyun.com/nexus/content/groups/public/
    

你可能感兴趣的:(linux,从入门到放弃)