linx安装 maven

云安装

yum -y install apache-maven

如果没有下载下来就先更新下资源包,再重试

wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

编辑文件/opt/maven/apache-maven-3.6.1/conf/settings.xml


    
     
              alimaven
              aliyun maven
              http://maven.aliyun.com/nexus/content/groups/public/
              central       
    
  

配置环境变量,编辑文件/etc/profile
在最下面添加以下内容(MAVEN_HOME是刚才解压maven的路径)

MAVEN_HOME=/opt/maven/apache-maven-3.6.1
export PATH=$MAVEN_HOME/bin:$PATH

刷新环境变量

source /etc/profile

到此安装完成,可以看到maven信息说明安装成功

[root@maruifu maven]# mvn -v
Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: /opt/maven/apache-maven-3.6.1
Java version: 1.8.0_141, vendor: Oracle Corporation, runtime: /usr/local/java/jdk1.8/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-957.21.3.el7.x86_64", arch: "amd64", family: "unix"

你可能感兴趣的:(运维环境)