Note when going straight for success of Mr.Wang

0%

Linux命令安装Maven

Linux(Centos7.6)安装maven3.6

  1. 下载文件:http://maven.apache.org/download.cgi
  2. 将文件放到/opt文件夹下面, 若没有上传命令先执行:

    1
    yum -y install lrzsz
  3. 解压到当前文件夹

    1
    tar zxvf maven*.tar.gz
  4. 添加阿里云镜像

    1
    2
    3
    4
    5
    6
    7
    8
    9
    vim /opt/maven/config/settings.xml
    ```
    ```xml
    <mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
    </mirror>
  5. 配置环境变量

    1
    2
    3
    4
    vim /etc/profile
    export MAVEN_HOME=/opt/apache-maven-3.6.3
    export PATH=$MAVEN_HOME/bin:$PATH
    source /etc/profile
  6. 校验是否安装成功

    1
    mvn -v\-version
-------------the end-------------