Nexus安裝配置(Linux)

Nexus安裝配置(Linux) java

、搭建nexus私服 1、解壓nexus-oss-webapp-1.8.0-bundle.tar.gz文件到指定目錄 Java代碼 #tar -zvxf nexus-oss-webapp-1.8.0-bundle.tar.gz 2、啓動nexus Java代碼 #cd /opt/maven/nexus-oss-webapp-1.8.0/bin/jsw 選擇本身機器的版本: #cd linux-x86-32/ #./nexus start 重啓: #./nexus restart 中止: #./nexus stop 3、運行nexus 在瀏覽器中輸入:http://localhost:8081/nexus  就能夠看到nexus 的主頁,
點擊右上角Log in 默認用戶名和密碼是:
admin/admin123 運行後會自動生成一個nexus工做目錄sonatype-work,nexus下載的jar包會存放在 sonatype-work/nexus/storage中 4、配置 1)點擊左側菜單Repositories 分別將右側列表中 Java代碼 Apache Snapshots Codehaus Snapshots Maven Central 三個repository 的Download Remote Index 配置改成True,並保存設置, 而後在列表中分別右鍵點擊三個Repository,點擊ReIndex 2)增長新的Repository,有一些比較經常使用jar包在nexus提供的repository中可能找不到, 通常比較經常使用的有 Java代碼 JBOSS的兩個: http://repository.jboss.org/maven2/  http://repository.jboss.org/nexus/content/repositories/releases/   SUN的: http://download.java.net/maven/2/  K-INT的: http://developer.k-int.com/maven2/   由於找juel:juel-impl:2.2.1 這個jar包,因此我還添加了一個本身找的: http://repository.exoplatform.org/content/groups/public/   添加步驟: Java代碼 點擊Add->Proxy Repository->填寫Repository ID, Repository Name, 以及Remote Storage Location 其餘的默認便可。 3) 將新增的Repository添加到Public Repositories中 在Public Repositories 的Configuration中,將多選Select中的項所有添加到左邊,而後保存。 4) 添加本身的jar包 Java代碼 在repository列表中有一個3rd party,也就是第三方jar包,點擊會看到一個Artifact Upload選項卡,點擊後,填寫相應的信息。 GAV Definition 通常選擇 GAV Parameters 而後添加Group:Artifact:Version:Package 示例 juel:juel-impl:2.2.1:jar 而後選擇要上傳的jar包,保存便可 5) nexus中設置代理服務器 選擇左側administrator菜單中的Server選項,在右側打開的頁面的中下部,有一個選擇項:Default HTTP Proxy Settings(optional) 將複選框選中,填寫相應的代理服務器信息便可。 6) 編寫本身的settings.xml,文件內容以下: Java代碼 <settings>  
      <proxies>  
        <proxy>  
          <id>normal</id>  
          <active>true</active>  
          <protocol>http</protocol>  
          <username>deployment</username>  
          <password>deploy</password>  
          <host>localhost:8081/nexus</host>  
          <port>80</port>  
          <nonProxyHosts>localhost:8081/nexus</nonProxyHosts>  
        </proxy>  
      </proxies>  
      
      <mirrors>  
        <mirror>  
          <!--This is used to direct the public snapshots repo in the profile below over to a different nexus group -->  
          <id>nexus-public-snapshots</id>  
          <mirrorOf>public-snapshots</mirrorOf>  
          <url>http://localhost:8081/nexus/content/groups/public-snapshots</url>  </mirror>  
        <mirror>  
          <!--This sends everything else to /public -->  
          <id>nexus</id>  
          <mirrorOf>*</mirrorOf>  
          <url>http://localhost:8081/nexus/content/groups/public</url>  </mirror>  
      </mirrors>  
        
      <profiles>  
        <profile>  
          <id>development</id>  
          <repositories>  
            <repository>  
              <id>central</id>  
              <url>http://central</url>  <releases><enabled>true</enabled></releases>  
              <snapshots><enabled>true</enabled></snapshots>  
            </repository>  
          </repositories>  
         <pluginRepositories>  
            <pluginRepository>  
              <id>central</id>  
              <url>http://central</url>  <releases><enabled>true</enabled></releases>  
              <snapshots><enabled>true</enabled></snapshots>  
            </pluginRepository>  
          </pluginRepositories>  
        </profile>  
        <profile>  
          <!--this profile will allow snapshots to be searched when activated-->  
          <id>public-snapshots</id>  
          <repositories>  
            <repository>  
              <id>public-snapshots</id>  
              <url>http://public-snapshots</url>  <releases><enabled>false</enabled></releases>  
              <snapshots><enabled>true</enabled></snapshots>  
            </repository>  
          </repositories>  
         <pluginRepositories> -------------------------------------------------------------------------------- 遇到這種警告: 

****************************************
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. linux

大概意思就是要在環境配置export RUN_AS_USER=root,臨時配置
 

在命令行下輸入: web

 

export RUN_AS_USER=root 瀏覽器

 

而後執行,就不會再提示了
./nexus start 服務器

--------------------------------------------------------------- app

Linux在啓動時,會自動執行/etc/rc.d目錄下的初始化程序,所以咱們能夠把啓動任務放到該目錄下: webapp

一、由於其中的rc.local是在完成全部初始化以後執行,所以能夠把啓動腳本寫到裏面; 
二、用root帳號登錄Linux,vi /etc/rc.d/rc.local編輯文件,在最後加入須要執行的腳本程序: maven

su -l $username -c "/nexus/nexus-2.8.0-05/bin/nexus start"
相關文章
相關標籤/搜索