Maven 安裝請見我先前的部落格: Linux 搭建 maven
1, Nexus 下載
Nexus 官方下載, 最新版下載: nexus-2.4.0-09-bundle.tar.gz
Nexus war下載: nexus-2.4.0-09.war
2, Nexus 安裝
(1) 建立解壓檔案夾:
mkdir nexus-2.4.0-09
(2) 解壓tar.gz檔案:
tar zxvf nexus-2.4.0-09-bundle.tar.gz -C nexus-2.4.0-09
註: nexus-2.4.0-09 內有兩個檔案夾 nexus-2.4.0-09 和 sonatype-work
(3) 拷貝至/opt/目錄下:
sudo mv nexus-2.4.0-09 /opt/
3, Nexus 啟動
nexus啟動是在bin目錄下,首先看一下啟動/關閉/重啟等命令, 輸入命令:
/opt/nexus-2.4.0-09/nexus-2.4.0-09/bin/nexus
出現如下選項:
啟動nexus:
/opt/nexus-2.4.0-09/nexus-2.4.0-09/bin/nexus start
關閉nexus:
/opt/nexus-2.4.0-09/nexus-2.4.0-09/bin/nexus stop
4, Nexus 驗證
啟動nexus後,在瀏覽器輸入地址: http://localhost:8081/nexus
出現上述頁面,說明配置nexus成功!
點擊右上方“Log in”, 輸入使用者名稱和密碼(預設使用者名:admin 密碼: admin123)登入
開啟遠程索引
新搭建的neuxs環境只是一個空的倉庫,需要手動和遠程中心庫進行同步,nexus預設是關閉遠程索引下載,最重要的一件事情就是開啟遠程索引下載。登陸nexus系統,預設使用者名密碼為admin/admin123。
點擊左邊Administration菜單下面的Repositories,找到右邊倉庫列表中的三個倉庫Apache Snapshots、Codehaus Snapshots、Central,然後在每一個倉庫的configuration下把Download Remote Indexes修改為true。然後在這三個倉庫上分別右鍵,選擇Repair Index,這樣Nexus就會去下載遠端索引檔案。
啟用第三方(3th party) Deployment Policy 為 Allow Redeploy
[root@localhost bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
修改vi ./bin/nexus 的 RUN_AS_USER=root
參考推薦:
Installing Nexus OSS(官方)
Maven 向私服nexus上傳jar
使用nexus搭建maven私服
nexus 命令上傳jar包
Repository Management with Nexus (推薦)
使用Nexus建立私服