Nexus 3.x Linux环境搭建(手把手) 排坑之旅

Nexus 3.x 界面升华 :Linux 系统下排坑之旅:

* Nexus 3.12.1-01 OSS为例*

**

- 环境搭建:

**

    1   下载地址:https://www.sonatype.com/download-oss-sonatype 
    2   WinSCP 上传文件此文件,解压:
    3   tar -xzvf  nexus-3.12.1-01-unix.tar.gz 解压
    4   配置PATH具有java的成员变量
  • 运行nexus

    1. cd nexus目录/bin
    2. ./nexus start 出现:then set the environment variable RUN_AS_USER=root
    3. vi nexus.rc run_as_user=root 配置启动用户 尽量不要是root 要不会提示 Detected execution as “root” user. This is NOT recommended!
  • 每次这么运行有些麻烦 想让系统重启的时候自动运行,构建成服务:
    1. sudo ln -s {nexus地址}/bin/nexus /etc/init.d/nexus
    2. 注意此次构建运行会出现:
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.8 and at most 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

这里写图片描述
加上这句话:然后重新输入:
如果先头已经运行了下面的命令:需要先去/etc/init.d/删除掉nexus服务

  1. sudo ln -s {nexus地址}/bin/nexus /etc/init.d/nexus 构建服务成功。
  2. service nexus status
  3. service nexus start
  4. service nexus stop

    系统自动重启:
    systenctk enable nexus.service 加入开机启动


之后进行配置nexus 默认端口8081 nexus下etc 可以改配置文件

打开: ipv4:8081 nexus 地址
右上角登录,admin admin123

这里写图片描述

创建如下三个库:
这里写图片描述

注意hosted:
这里写图片描述

然后经过配置 xml pom 文件就可以进行使用了

  <mirrors>
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
  </mirrors>

profile>
    <id>nexus</id>
    <!--Enable snapshots for the built in central repo to direct -->
    <!--all requests to nexus via the mirror -->
    <repositories>
        <repository>
        <id>central</id>
        <url>http://xxxxx/repository/rainGroup/</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
        <id>central</id>
        <url>http://xxxxx/repository/rainGroup/</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
        </pluginRepository>
    </pluginRepositories>
    </profile>
  </profiles>
    <activeProfiles>
                  <activeProfile>nexus</activeProfile>
  </activeProfiles>

pom.xml:

 <distributionManagement>
        <repository>
            <id>thirdparty</id>
            <name>Nexus Thirdparty Repository</name>
            <url>http://xxxxx:8081/repository/rainGroup/</url>
        </repository>
        <snapshotRepository>
            <id>nexus</id>
            <name>Nexus Snapshot</name>
            <url>http://xxxxxxx:8081/repository/rainGroup/</url>
        </snapshotRepository>
    </distributionManagement>
    <repositories>
        <repository>
            <id>nexus</id>
            <url>http://xxxxxx/repository/rainGroup/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

猜你喜欢

转载自blog.csdn.net/qq_36324685/article/details/80822174
今日推荐