已安装 JDK7 并配置好了环境变量

1

  1. wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-
  2. 03-bundle.tar.gz

2、解压

  1. # mkdir nexus
  2. # tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C nexus
  3. # cd nexus
  4. # ls
  5. nexus-2.11.2-03 sonatype-work
  6. (一个 nexus 服务,一个私有库目录)

3、编辑 Nexus 的 nexus.properties 文件,配置端口和 work

  1. 目录信息(保留默认)
  2. # cd nexus-2.11.2-03
  3. # ls
  4. bin conf lib LICENSE.txt logs nexus NOTICE.txt tmp
  5. 查看目录结构,jetty 运行
  6. # cd conf
  7. # vi nexus.properties
  8. # Jetty section
  9. application-port=8081
  10. application-host=0.0.0.0
  11. nexus-webapp=${bundleBasedir}/nexus
  12. nexus-webapp-context-path=/nexus
  13. # Nexus section
  14. nexus-work=${bundleBasedir}/../sonatype-work/nexus
  15. runtime=${bundleBasedir}/nexus/WEB-INF

4、编辑 nexus 脚本, 配置 RUN_AS_USER 参数

  1. # vi /root/nexus/nexus-2.11.2-03/bin/nexus
  2. #RUN_AS_USER=
  3. 改为:
  4. RUN_AS_USER=root

5、防火墙中打开 8081 端口

  1. # vi /etc/sysconfig/iptables
  2. 添加:
  3. -A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
  4. 保存后重启防火墙
  5. # service iptables restart

6、启动 nexus

  1. # /root/nexus/nexus-2.11.2-03/bin/nexus start
  2. ****************************************
  3. WARNING - NOT RECOMMENDED TO RUN AS ROOT
  4. ****************************************
  5. Starting Nexus OSS...
  6. Started Nexus OSS.

7、浏览器中打开:http://192.168.4.221:8081/nexus/

8、登录,默认用户名 admin,默认密码 admin123:

9、设置 proxy 代理仓库(Apache Snapshots/Central/Codehaus Snapshots)准许远程下载,