安装NEXUS私有仓库

环境:

  centos6.3 minimal

  jdk-7u40-linux-i586.tar.gz

  apache-maven-3.1.1-bin.tar.gz

  nexus-2.7.0-05-bundle.zip

 

 

下载:

 #yum install -y wget unzip

 #cd /opt

 //jdk-7u40-linux-i586.tar.gz使用浏览器下载后复制到opt目录

 #wget http://download.sonatype.com/nexus/oss/nexus-2.7.0-05-bundle.zip

 #wget http://mirrors.hust.edu.cn/apache/maven/maven-3/3.1.1/binaries/apache-maven-3.1.1-bin.tar.gz

 

 安装:

 #tar  zxvf  jdk-7u40-linux-i586.tar.gz

 #tar zxvf  apache-maven-3.1.1-bin.tar.gz

 #unzip nexus-2.7.0-05-bundle.zip

 

 #mv jdk1.7.0_40  /usr/local

 #mv apache-maven-3.1.1  /usr/local

 #mv nexus-2.7.0-05  /usr/local

 #mv sonatype-work  /usr/local

 

 #useradd nexus   //新建一个用户

 #chown nexus -R  /usr/local/nexus-2.7.0-05

 #chown nexus -R  /usr/local/sonatype-work

 #vim /usr/local/nexus-2.7.0-05/bin/nexus

   修改 RUN_AS_USER=nexus

 

设置环境变量:

 #vim /etc/profile

  在原有export PATH之前添加以下内容:

   export JAVA_HOME="/usr/local/jdk1.7.0_40"

   export CLASSPATH="$JAVA_HOME/lib/dt.jar:$JAVA_HOME/tools.jar"

   PATH="$JAVA_HOME/bin:$PATH"

   export M2_HOME="/usr/local/apache-maven-3.1.1"

   export M2="$M2_HOME/bin"

   PATH="$M2:$PATH"

 

设置开机启动项:

  #echo "/usr/local/nexus-2.7.0-05/bin/nexus start"  >>  /etc/rc.local

 

启动:

  #/usr/local/nexus-2.7.0-05/bin/nexus help   //查看命令项

  #/usr/local/nexus-2.7.0-05/bin/nexus start

 //nexus默认启动端口是8081

 

访问:

  先关闭iptables或者开启8081端口

  比如服务器ip是192.168.1.80

  使用浏览器:http://192.168.1.80:8081/nexus

 

 默认用户:admin

        密码:admin123

 

 设置:

  使用admin登陆系统后,点击左边栏Repositories,设置中央仓库central自动下载indexes,Download Remote Indexes设置为TRUE,如下图

 

  设置仓库组,点击Public Repositories,在Configuration下会出现二个列表框,左边的是实际在仓库组的,右边的是当前可得到的未在仓库组的,如下图

 

  Eclipse使用设置:

  当前使用eclipse juno版本,先需要安装e2clipse

  打开eclipse -> 菜单栏help -> Install New Software ->  Add -> Name: m2e  Location:http://wiki.eclipse.org/M2E_updatesite_and_gittags

  安装好后,eclipse -> 菜单栏Window -> Preferences -> 左边会有MAVEN选项

  编辑用户setting.xml,添加mirror

<mirror>
    	<id>nexus</id>
    	<mirrorOf>*</mirrorOf>
    	<name>public repos</name>
    	<url>http://192.168.1.80:8081/nexus/content/groups/public/</url>
</mirror>

<profile>
      <id>nexus</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>
<activeProfiles>
    <activeProfile>nexus</activeProfile>
</activeProfiles>

添加到相应节点下。

 

 如果用户不能搜索index,有二种方式可以使用:

 第一种:菜单栏Window -> Show view -> Maven repositories

可以右键Rebuild Index。

如果这种方法还是不行,那么可以使用第二种方法:

清除e2clipse缓存,删除.m2\repository\.cache\m2e\下面所有的子文件夹,重启eclipse一般就能解决。

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值