【Maven】centos搭建maven私服

版权声明:若博客内容对你有些许帮助,请在本页左下角,进行援助。 一毛不嫌少,一块不嫌多。 《文章中所出现软件下载,若失效,加群523575753获取 》。-.- 《 本文为博主原创文章,未经博主允许不得转载》。另附:打开支付宝首页搜索“523248402”,即可领红包。偶尔会有大红包哦! https://blog.csdn.net/Vchen_hao/article/details/70800702

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>

猜你喜欢

转载自blog.csdn.net/Vchen_hao/article/details/70800702
今日推荐