1. 下載maven
maven:http://maven.apache.org/download.cgi
我下載的是:apache-maven-3.1.0-bin.tar.gz
2. 移動自己的存放目錄
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/下載$ mv apache-maven-3.1.0-bin.tar.gz /home/bixiaopeng/soft/jarsbixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/下載$ cd /home/bixiaopeng/soft/jars
3. 解壓
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/jars$ tar -zxvf apache-maven-3.1.0-bin.tar.gz#查看解壓後的結果bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/jars$ ls -al apache-maven-3.1.0/總用量 44drwxrwxr-x 6 bixiaopeng bixiaopeng 4096 8月 21 14:29 .drwxrwxr-x 3 bixiaopeng bixiaopeng 4096 8月 21 14:29 ..drwxrwxr-x 2 bixiaopeng bixiaopeng 4096 8月 21 14:29 bindrwxrwxr-x 2 bixiaopeng bixiaopeng 4096 8月 21 14:29 bootdrwxr-xr-x 3 bixiaopeng bixiaopeng 4096 6月 28 10:12 confdrwxr-xr-x 3 bixiaopeng bixiaopeng 4096 6月 28 10:12 lib-rw-r--r-- 1 bixiaopeng bixiaopeng 11358 6月 28 10:12 LICENSE.txt-rw-r--r-- 1 bixiaopeng bixiaopeng 1112 6月 28 10:12 NOTICE.txt-rw-r--r-- 1 bixiaopeng bixiaopeng 2513 6月 28 10:12 README.txt
4. 配置maven環境變數
vim ~/.bashrc
#添加在檔案底部
export MAVEN_HOME=/home/bixiaopeng/soft/jars/apache-maven-3.1.0export PATH=${MAVEN_HOME}/bin:$PATH
5. 修攺完成後使其立即生效
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/jars$ source ~/.bashrc
6. 查看一下版本
bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~/soft/jars$ cd ~bixiaopeng@bixiaopeng-To-be-filled-by-O-E-M:~$ mvn -vApache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 10:15:32+0800)Maven home: /home/bixiaopeng/soft/jars/apache-maven-3.1.0Java version: 1.6.0_45, vendor: Sun Microsystems Inc.Java home: /home/bixiaopeng/soft/jvm/jdk/jreDefault locale: zh_CN, platform encoding: UTF-8OS name: "linux", version: "3.8.0-27-generic", arch: "amd64", family: "unix"