linux 安裝maven和nexus
阿新 • • 發佈:2018-12-13
linux安裝maven
下載解壓
wget -c http://apache.claz.org/maven/maven-3/3.5.4/binaries/apache-maven-3.5.4-bin.tar.gz
tar -zxvf apache-maven-3.5.4-bin.tar.gz
匯入環境變數
開啟檔案 vi /etc/profile
export MAVEN_HOME=/usr/local/apache-maven-3.5.4
export MAVEN_HOME
export PATH=$PATH:$MAVEN_HOME/bin
驗證maven安裝成功
mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-18T02:33:14+08:00) Maven home: /usr/local/apache-maven-3.5.4 Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/java/jdk1.8.0_181/jre Default locale: en_US, platform encoding: ANSI_X3.4-1968 OS name: "linux", version: "4.4.0-105-generic", arch: "amd64", family: "unix"
Linux安裝nexus
開啟連線https://help.sonatype.com/repomanager3/download/download-archives---repository-manager-3
下載tar.gz的安裝包,然後拷貝到伺服器上。
##解壓
tar -zxvf nexus-3.13.0-01-unix.tar.gz
啟動服務
/usr/local/nexus/nexus-3.13.0-01/bin/nexus start
如果起不來,大家可以用/usr/local/nexus/nexus-3.13.0-01/bin/nexus run
來檢視啟動日誌,如果遇到如下錯誤
WARNING: ************************************************************ WARNING: Detected execution as "root" user. This is NOT recommended! WARNING: ************************************************************ Starting nexus
是nexus不讓使用root來啟動服務。之後切換使用者,報下邊的錯誤
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log Warning: Forcing option -XX:LogFile=/tmp/jvm.log Unable to update instance pid: Unable to create directory /usr/local/nexus/sonatype-work/nexus3/instances /usr/local/nexus/sonatype-work/nexus3/log/karaf.log (Permission denied) Unable to update instance pid: Unable to create directory /usr/local/nexus/sonatype-work/nexus3/instances
是表示切換的使用者沒有許可權操作nexus解壓後生成的sonatype-work資料夾,所以需要在root下,給當前使用者讀寫許可權。
chown menghb:menghb -R sonatype-work/
之後開啟***.***.***.***:8081,就能看到nexus的主頁面,登入密碼預設是admin/admin123,如果要改密碼,可以在介面上改,如果要改埠,就去etc/nexus-default.properties去修改相關引數。