安裝配置java
# 安裝jdk,參考其餘教程 mkdir -p /app/nexus2 # 建立目錄 wget https://download.sonatype.com/nexus/oss/nexus-2.14.8-01-bundle.tar.gz # 解壓 tar -zxvf nexus-2.14.8-01-bundle.tar.gz # 修改配置, 在頭部添加配置"export RUN_AS_USER=root" vim /etc/profile source /etc/profile # 進入目錄 cd /app/nexus2/nexus-2.14.8-01/bin # 啓動maven ./nexus start # 瀏覽器訪問http://172.16.48.129:8081/nexus/
配置文件夾以及路徑apache
/app/nexus2/nexus-2.14.8-01/confvim
日誌文件夾以及路徑瀏覽器
/app/nexus2/nexus-2.14.8-01/logs服務器
索引數據目錄:sonatype-work/nexus/indexerapp
手動更新所需文件準備:maven
nexus-maven-repository-index.properties優化
在maven的官方網站可以找到:http://repo.maven.apache.org/maven2/.index/網站
indexer-cli-5.1.1.jar.net
在maven網站中搜索indexer-cli找尋對應的版本號:http://search.maven.org/
更新索引:
# 安裝jdk先決條件,後續須要使用java命令進行索引解壓縮處理 # 進行這些操做的時候,最好中止nexus服務器,./nexus stop 防止出現異常狀況 # 建立索引壓縮包放置目錄 mkdir -p /app/nexus/index # 將文件上傳到服務器在同一個目錄下面 ll # 運行結果 -rw-r--r-- 1 root root 6576184 11月 1 10:34 indexer-cli-5.1.1.jar -rw-r--r-- 1 root root 578261578 11月 1 10:34 nexus-maven-repository-index.gz -rw-r--r-- 1 root root 1130 11月 1 10:34 nexus-maven-repository-index.properties # 解壓縮索引文件,須要等待完成,中途中斷,請刪除生成文件夾從新執行命令 java -jar indexer-cli-5.1.1.jar -u nexus-maven-repository-index.gz -d indexer # 運行結果 Index Folder: /app/nexus/index Output Folder: /app/nexus/index/indexer Total time: 7 min 7 sec Final memory: 77M/131M # 將解壓出來的/app/nexus/index/indexer的全部文件,拷貝到nexus工做目錄中的indexer的/app/nexus/sonatype-work/nexus/indexer/central-ctx中央倉庫的索引目錄中 rm -rf /app/nexus/sonatype-work/nexus/indexer/central-ctx/* cp -r /app/nexus/index/indexer/* /app/nexus/sonatype-work/nexus/indexer/central-ctx # 啓動nexus,./nexus start進入中央倉庫,刷新全部便可,而且設置與中央倉庫的同步
Nexus的構件倉庫都保存在sonatype-work目錄中,該目錄的位置由nexus/conf/nexus.properties配置文件指定。
倉庫遷移須要兩個過程:備份和還原
備份倉庫:將sonatype-work文件夾總體備份便可,也能夠選擇只備份最重要的兩個文件夾索引(indexer)和倉庫(storage)
還原倉庫:將備份好的sonatype-work文件拷貝到新的服務器中。而後修改nexus/conf/nexus.properties配置文件,從新指定倉庫的目錄。
將public倉庫關聯上全部的倉庫,方便查找,以下圖:
添加任務:http://crabdave.iteye.com/blog/2358012
官方博客介紹:https://blog.sonatype.com/2009/09/nexus-scheduled-tasks/
設定開機啓動:http://www.javashuo.com/article/p-dsytlnyf-hv.html
經常使用配置:https://blog.csdn.net/kinglyjn/article/details/53585721