zoukankan      html  css  js  c++  java
  • CentOS7安装和配置Nexus3

    1. 官网 https://www.sonatype.com/download-oss-sonatype 下载安装包,通过客户端上传安装包到服务器

    2. 解压

      cd /usr/local/

      mkdir nexus

      cd /usr/local/nexus

      cp [src] /usr/local/nexus/

      tar -zxvf nexus-3.21.1-01-unix.tar.gz

    3. 修改启动参数

      修改端口

        cd /usr/local/nexus-3.21.1-01/etc

        vi nexus-default.properties

      根据服务器配置修改内存

        cd /usr/local/nexus-3.21.1-01/bin

        vi nexus.vmoptions

    4. 启动

      cd /usr/local/nexus-3.21.1-01/bin

      ./nexus run

      其它常用命令:

        ./nexus console

        ./nexus start

        ./nexus stop

        ./nexus status

        ./nexus restart

    5. 获取默认登录密码

      账户:admin

      获取密码: find / -name admin.password

    6. 登录 http://[ip]/[port]

      使用账号登入后,可以设置阿里云代理替换maven-central

      https://maven.aliyun.com/nexus/content/groups/public/

    7. Maven客户端配置:

      settings.xml 添加如下配置:

     1   <server>
     2     <id>gs-releases</id>
     3     <username>user</username>
     4     <password>password</password>
     5   </server>
     6   <server>
     7     <id>gs-snapshots</id>
     8     <username>user</username>
     9     <password>password</password>
    10   </server>
    11 
    12   <mirror>
    13     <id>gs-public</id>
    14     <name>gs-public</name>
    15     <mirrorOf>*</mirrorOf>
    16     <url>http://[ip]:[port]/repository/gs-public/</url>
    17   </mirror>
    18 
    19   <profile>
    20       <id>nexus</id>
    21       <repositories>
    22         <repository>
    23           <id>central</id>
    24           <name>Nexus</name>
    25           <url>http://[ip]:[port]/repository/gs-public/</url>
    26           <releases>
    27             <enabled>true</enabled>
    28           </releases>
    29           <snapshots>
    30             <enabled>true</enabled>
    31           </snapshots>
    32         </repository>
    33       </repositories>
    34       <pluginRepositories>
    35         <pluginRepository>
    36           <id>central</id>
    37           <name>Nexus</name>
    38           <url>http://[ip]:port/repository/gs-public/</url>
    39           <releases>
    40             <enabled>true</enabled>
    41           </releases>
    42           <snapshots>
    43             <enabled>true</enabled>
    44           </snapshots>
    45         </pluginRepository>
    46       </pluginRepositories>
    47     </profile>
    48 
    49   <activeProfiles>
    50     <activeProfile>nexus</activeProfile>
    51     <!--<activeProfile>dev</activeProfile>-->
    52   </activeProfiles>

      若私服不开放访问,还需增加如下配置:

    1     <server>
    2       <id>gs-public</id>
    3       <username>user</username>
    4       <password>password</password>
    5     </server>

    8. 项目配置

      pom.xml 添加如下配置

     1   <distributionManagement>
     2         <repository>
     3             <id>gs-releases</id>
     4             <name>gs-releases</name>
     5             <url>http://[ip]:[port]/repository/gs-releases/</url>
     6         </repository>
     7         <snapshotRepository>
     8             <id>gs-snapshots</id>
     9             <name>gs-snapshots</name>
    10             <url>http://[ip]:[port]/repository/gs-snapshots/</url>
    11         </snapshotRepository>
    12     </distributionManagement>

    参考文章:

      https://www.cnblogs.com/endv/p/11204704.html 使用Nexus3搭建Maven私服+上传第三方jar包到本地maven仓库

      https://www.cnblogs.com/wbl001/p/11154828.html 【原创】Docker 搭建Maven私服nexus 3.17初始密码登录不上问题/admin登陆不上问题

      https://www.cnblogs.com/helong/articles/2254446.html 使用Nexus创建私服

  • 相关阅读:
    查看本机安装了哪些.Net Framework版本的方法
    tomcat启动超时, Server Tomcat v6.0 Server at localhost was unable to start within 45 seconds...
    设置PL/SQL Developer 字符集
    JDK安装与环境变量配置
    function 与 => 的区别
    如何使用tomcat,使用域名直接访问javaweb项目首页
    Spring整合Struts2
    Oracle to_char函数的使用方法
    PLSQL 误删表恢复操作
    Python可视化动态图表,基于Python环境,使用jupyter notebook编辑ipynb文件,基于pyecharts生成Sankey的桑基图HTML制作
  • 原文地址:https://www.cnblogs.com/tarencez/p/12430886.html
Copyright © 2011-2022 走看看