仿照本身平時本地測試時配環境,來搭建服務器環境。由於不想用源中的tomcat版本,因此本身下了個想要的。ubuntu+maven3.3.9。以前在阿里雲服務器上安裝了vsftpd,因此準備好的安裝文件都是經過ftp上傳到服務器。習慣把解壓後的文件放在/opt目錄下apache
1.解壓apache-maven-3.3.9.tar.gzubuntu
tar -zxvf apache-maven-3.3.9.tar.gz
2.解壓目錄移動到/optvim
mv apache-maven-3.3.9 /opt
3.配置maven的環境變量tomcat
export MAVEN_HOME=/opt/apache-maven-3.3.9 export PATH=$MAVEN_HOME/bin:$PATH
4.刷新一下環境設置服務器
source /etc/profile
5.檢查maven
mvn -v
6.maven下載速度慢解決方案測試
maven/conf/settings.xmlthis
<?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <!-- 阿里雲倉庫 --> <mirror> <id>alimaven</id> <mirrorOf>central</mirrorOf> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/repositories/central/</url> </mirror> <!-- 中央倉庫1 --> <mirror> <id>repo1</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo1.maven.org/maven2/</url> </mirror> <!-- 中央倉庫2 --> <mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> </mirrors> </settings>
一、說明阿里雲
我把本身的全部環境都放在根目錄下的/develop,裏面有maven、tomcat、url
二、maven官網下載maven.tar.gz默認解壓。解壓後的文件夾移動到/develop
三、配置maven的環境變量
sudo vim /etc/profile
########## m2_home M2_HOME=/Users/zhaodang/develop/apache-maven-3.3.9 PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH:. export PATH export M2_HOME
四、生效
source /etc/profile mvn -v >>Maven home: /Users/zhaodang/develop/apache-maven-3.3.9 >>Java version: 1.8.0_111, vendor: Oracle Corporation >>Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home/jre >>Default locale: zh_CN, platform encoding: UTF-8 >>OS name: "mac os x", version: "10.12", arch: "x86_64", family: "mac"