题记: 最近又在整java dubbo ,用maven 做构建工具,鉴于国内网速。。。所以搭建了个nexus
环境:开发机:WIN7 + eclipse Luna Service Release 2 (4.4.2) + JDK1.7 + apache-maven-3.2.2
服务器:
[devtac@test_1 ~]$ lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 6.4 (Santiago) Release: 6.4 Codename: Santiago
[wls81@test_1 ~]$ mvn -version Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00) Maven home: /home/wls81/localmaven/apache-maven-3.3.3 Java version: 1.8.0_51, vendor: Oracle Corporation Java home: /usr/java/jdk1.8.0_51/jre Default locale: zh_CN, platform encoding: UTF-8 OS name: "linux", version: "2.6.32-358.el6.x86_64", arch: "amd64", family: "unix"
一.开发机和服务器上配置maven, jdk 环境变量,并验证
此处暂时省略。
二.下载并安装nexus-2.11.4-01-bundle.tar.gz
2.1 下载官网下载有点慢,百度网盘分享链接: http://pan.baidu.com/s/1sjHq0qT 密码: ig42
2.2 解压到安装目录
tar -zxvf nexus-2.11.4-01-bundle.tar.gz
2.3 启动
nexus-2.11.4-01/bin/nexus start
检查是否启动成功
netstat -anp | grep 8081
PS:nexus 内置了jetty 默认启动端口是8081
端口配置文件在
nexus-2.11.4-01/conf 目录下 nexus.properties 文件里
2.4 浏览器访问
问题: 我这边监听到了端口,但是在浏览器怎么都访问不了。之后找到原因。服务器IPTABLES 默认策略不是ACCEPT
iptables 里添加这个
需要root 用户 service iptable save vi /etc/sysconfig/iptable 添加这个 -A INPUT -p tcp -m state --state NEW -m tcp --dport 8081 -j ACCEPT 保存退出 重启iptables service iptables restart
浏览器访问 输入admin /admin123 登录
http://192.168.100.241:8081/nexus/#welcome
2.4.1 配置 Central 的Download Remote Indexes 为true
鼠标左键点击Central,会出现下图,设置Download Remote Indexes 为true 并点击save
2.4.2 Central repair index
鼠标右键点击 Central,出现下图,点击Repair index
2.5 同上设置Apache Snapshots 和Codehaus Snapshots
三 设置开发机 maven 配置文件
注意eclipse 关联的maven 配置文件
<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://162.168.100.241:8081/nexus/content/groups/public-snapshots</url> </mirror> <mirror> <!--This sends everything else to /public --> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://192.168.100.241:8081/nexus/content/groups/public</url> </mirror>
四 然后就可以使用了。