Linux:CentOS7安装maven私服Nexus

一、下载

Nexus的下载地址:https://www.sonatype.com/download-oss-sonatype
选择对应的版本
这里写图片描述

二、安装

创建文件夹Neuxs,将下载的文件上传

tar -zxvf nexus-2.14.5-02-bundle.tar.gz

查看目录文件:
nexus-2.11.2-03 sonatype-work
(一个 nexus 服务,一个私有库目录)
这里写图片描述

三、修改配置文件

3.1修改nexus.properties 文件

进入Neuxs的conf目录编辑配置nexus.properties 文件,配置端口和 work 目录信息,我这里是保持的默认

vi nexus-2.14.5-02/conf/nexus.properties

这里写图片描述

3.2编辑 nexus 脚本, 配置 RUN_AS_USER 参数(不改启动报错)
# vi / nexus-2.14.5-02/bin/nexus
#RUN_AS_USER=
改为:
RUN_AS_USER=root
3.3 打开防火墙端口8081
# vi /etc/sysconfig/iptables
添加:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8081 -j ACCEPT
保存后重启防火墙
# service iptables restart

四、启动登录

启动nexus
[root@localhost bin]# nexus start
登录
192.168.251.130:8081/nexus
用户名:admin
密码:admin123
这里写图片描述

对Nexus页面中元素的介绍和需要配置的参数请参考
Window搭建maven私服

五、私服的使用

maven私服的使用请参考
Window搭建maven私服

六.本地maven的Setting.xml配置

配置Nexus的用户名和密码,目的是为了我们把本地的项目发布到私服中。

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

配置私服的镜像

<mirror>
        <id>nexus</id>
        <mirrorOf>*</mirrorOf>
        <url>http://192.168.251.130:8081/nexus/content/groups/public/</url>
</mirror>

下边的配置是让加载jar从私服中加载和默认的jdk

<profile>
        <id>nexus</id>
        <repositories>
            <repository>
                    <id>central</id>
                    <url>http://repo1.maven.org/maven2/</url>
                    <releases><enabled>true</enabled></releases>
                    <snapshots><enabled>true</enabled></snapshots>
            </repository>
        </repositories>
        <pluginRepositories>
            <pluginRepository>
                  <id>central</id>
                  <url>http://repo1.maven.org/maven2/</url>
                  <releases><enabled>true</enabled></releases>
                  <snapshots><enabled>true</enabled></snapshots>
            </pluginRepository>
        </pluginRepositories>
   </profile>
   <profile>  
        <id>jdk17</id>  
         <activation>  
              <activeByDefault>true</activeByDefault>  
              <jdk>1.7</jdk>  
         </activation>  
         <properties>  
              <maven.compiler.source>1.7</maven.compiler.source>  
              <maven.compiler.target>1.7</maven.compiler.target>  
              <maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>  
         </properties>   
    </profile>

激活profile

<!-- 激活profile,注意id对应-->
    <activeProfiles>
        <activeProfile>nexus</activeProfile>
    </activeProfiles>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值