【Maven】centos搭建maven私服

本文详细介绍了如何在CentOS 6.6环境下安装配置Nexus 3搭建Maven私服,包括环境准备、Nexus安装启动、访问配置及优化等步骤,并提供了默认账号密码、端口设置及客户端配置示例。

1.环境说明

安装环境:

操作系统:centos6.6 64位。
JDK:jdk1.8 64位
nexus:nexus3.3.0

2.安装nexus

nexus官网下载地址:http://www.sonatype.com/download-oss-sonatype

nexus3.3.0官网下载地址:https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.3.0-01-unix.tar.gz

1.解压

[root@localhost ~]# tar zxvf nexus-3.3.0-01-unix.tar.gz 

2.启动。

进入bin目录,运行如下命令启动(&符号表示后台启动):

[root@localhost bin]# ./nexus run &

出现以下日志表示启动成功!

-------------------------------------------------

Started Sonatype Nexus OSS 3.3.0-01

-------------------------------------------------

3.访问私服:

nexus启动成功之后,就可以访问私服了。

nexus3.X的默认端口是:8081

nexus3.X的默认账号是:admin

nexus3.X的默认密码是:admin123

nexus3.X搭建的maven3.3.9

私服的本地访问地址是:http://私服的ip:8081

OK,到这里一个maven3的私服就搭建好了!

4.优化配置:

1.把nexus3.1加入到系统服务,使之能够开机自启动:
[root@localhost bin]# ln -s /root/nexus-3.3.0-01/bin/nexus /etc/init.d/nexus3
[root@localhost bin]# chkconfig --add nexus3
chkconfig nexus3 on
2.修改运行nexus3所使用的用户
[root@localhost bin]# vi nexus.rc

run_as_user="root"
3.修改nexus3启动时要使用的jdk版本:
[root@localhost bin]# vi nexus

INSTALL4J_JAVA_HOME_OVERRIDE=/usr/local/java/jdk1.8.0_121
4.修改nexus3默认端口:
[root@localhost etc]# vim /root/nexus-3.3.0-01/etc/nexus-default.properties

application-port=8282
5.修改nexus3数据以及相关日志的存储位置:
[root@localhost bin]# vim /root/nexus-3.3.0-01/bin/nexus.vmoptions

-XX:LogFile=./sonatype-work/nexus3/log/jvm.log

-Dkaraf.data=./sonatype-work/nexus3

-Djava.io.tmpdir=./sonatype-work/nexus3/tmp
6.现在我们可以启动nexus3使用如下命令:
[root@localhost bin]# /etc/init.d/nexus3 start

3.maven客户端配置

1.servers加入如下配置:

<server>      
    <id>releases</id>     
     <username>admin</username>      
     <password>admin123</password>    
</server>    
<server>      
     <id>snapshots</id>      
     <username>admin</username>      
     <password>admin123</password>    
</server>

2.mirrors加入如下配置:

<!--创建一个匹配任何仓 库的镜像,镜像的地址为私服,这样,所有的请求都经过私服-->      
<mirror> 
    <id>central</id>
    <mirrorOf>*</mirrorOf>
    <url>http://192.168.*.*:8081/nexus/content/groups/public/</url>    
</mirror>
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

帅胖子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值