Maven 私有库和本地库的安装与配置 Sonatype Nexus+Maven

本文详细介绍如何在CentOS 6.6环境下部署Sonatype Nexus作为Maven私有仓库,包括下载、解压、配置端口及目录信息、设置防火墙、启动服务等步骤。
环境:CentOS 6.6 Final、JDK7、Sonatype Nexus、Maven

IP:192.168.4.221

root 用户操作

前提:已安装 JDK8 并配置好了环境变量

1、下载最新版 Nexus http://www.sonatype.org/nexus/go/

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

2、解压

#mkdir nexus

#tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C nexus

#cd nexus

#ls

nexus-2.11.2-03 sonatype-work (一个 nexus 服务,一个私有库目录)

3、编辑 Nexus 的 nexus.properties 文件,配置端口和 work 目录信息(保留默认)

#cd nexus-2.11.2-03

#ls

bin	conf	lib	LICENSE.txt	logs	nexus	NOTICE.txt	tmp

查看目录结构,jetty 运行

#cd conf

#vi nexus.properties

#Jetty section application-port=8081 
application-host=0.0.0.0 nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus



#Nexus section

nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF



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

# vi /root/nexus/nexus-2.11.2-03/bin/nexus


#RUN_AS_USER=

改为:

RUN_AS_USER=root

5、防火墙中打开 8081 端口

# vi /etc/sysconfig/iptables

添加:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT

保存后重启防火墙

# service iptables restart

6、启动 nexus

# /root/nexus/nexus-2.11.2-03/bin/nexus start

****************************************

WARNING - NOT RECOMMENDED TO RUN AS ROOT

****************************************

Starting Nexus OSS...

Started Nexus OSS.

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

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

 

转载于:https://my.oschina.net/u/1266221/blog/858283

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值