1. 程式人生 > >Maven私有庫和本地庫的安裝與配置 Sonatype Nexus + Maven

Maven私有庫和本地庫的安裝與配置 Sonatype Nexus + Maven

環境:CentOS 6.6 Final、JDK7、Sonatype Nexus、Maven
IP:192.168.4.221
root使用者操作

前提:已安裝JDK7並配置好了環境變數

2、解壓
mkdir nexus
tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C nexus
cd nexus
ls
nexus-2.11.2-03 sonatype-work
(一個nexus服務,一個私有庫目錄)

3、編輯Nexus的nexus.properties檔案,配置埠和work目錄資訊(保留預設)
cd nexus-2.11.2-03
ls
bin conf lib LICENSE.txt logs nexus NOTICE.txt tmp
檢視目錄結構,jetty執行

cd conf
vi nexus.properties
Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF

4、編輯nexus指令碼, 配置RUN_AS_USER引數
vi /root/nexus/nexus-2.11.2-03/bin/nexus
RUN_AS_USER=
改為:
RUN_AS_USER=root

5、防火牆中開啟8081埠
vi /etc/sysconfig/iptables
新增:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
儲存後重啟防火牆
service iptables restart

6、啟動nexus
/root/nexus/nexus-2.11.2-03/bin/nexus start

WARNING - NOT RECOMMENDED TO RUN AS ROOT