Nexus 搭建及基础使用

news/2024/7/8 7:00:32

1 解压

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

2 启动

cd /usr/local/nexus-3.19.1-01/bin
./nexus  start

在这里插入图片描述

3 删除刚才的进程

在这里插入图片描述

4 新建账户

useradd  nexus
chown -R nexus:nexus  /usr/local/nexus-3.19.1-01/

5 切换用户

su nexus
cd /usr/local/nexus-3.19.1-01/bin
#启动
./nexus start
#查看是否启动
ps aux | grep nexus

在这里插入图片描述

6 查看日志

#命令
./nexus run

在这里插入图片描述

7 授权启动

#切换root
su root
#root用户
chown -R nexus:nexus /usr/local/sonatype-work/
#切换
su nexus
#启动
cd /usr/local/nexus-3.19.1-01/bin
#启动
nohup ./nexus run >nexus.log 2>&1   &

8 访问

http://192.168.38.45:8081/

在这里插入图片描述

9 设置密码

#查看默认密码,用默认密码登录会提示设置新的密码,我设置123456
cd /usr/local/sonatype-work/nexus3

在这里插入图片描述

10 登录成功

在这里插入图片描述

11 修改limit

#root 用户 
su root
#新增
vim /etc/security/limits.conf
* hard nofile 65536
* soft nofile 65536

12 重启

#nexus 用户
su nexus
#启动
cd /usr/local/nexus-3.19.1-01/bin
nohup ./nexus restart >nexus.log 2>&1   &

在这里插入图片描述

13 Nexus 使用

13.1 修改阿里云代理

在这里插入图片描述
在这里插入图片描述

13.2 修改maven setting.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
   
  <localRepository>F:\m2-springboot</localRepository>
   
  <pluginGroups></pluginGroups>
  <proxies></proxies>
  
  <mirrors>
     <!--配置私服,id与server rosh-admin 一致-->
      <mirror>
      <id>rosh-admin</id>
       <mirrorOf>*</mirrorOf>
       <name>Nexus Mirror</name>
       <url>http://192.168.38.45:8081/repository/maven-public/</url>
    </mirror>
      <!--配置阿里云-->
      <mirror>
          <id>alimaven</id>
          <name>aliyun maven</name>
          <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
          <mirrorOf>central</mirrorOf>
      </mirror>
  </mirrors>
  <servers>
      <server>
          <id>rosh-admin</id>
          <username>admin</username>
          <password>123456</password>
      </server>
      <!--快照-->
      <server>
          <id>rosh-releases</id>
          <username>admin</username>
          <password>123456</password>
      </server>
      <!--稳定-->
      <server>
          <id>rosh-snapshots</id>
          <username>admin</username>
          <password>123456</password>
      </server>
  </servers>
  <profiles>
    <profile>
      <id>Deployment</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
     <!--私有仓库地址-->
      <repositories>
          <repository>
            <id>Deployment</id>
            <url>http://192.168.38.45:8081/repository/maven-public/</url>
            <releases>
              <enabled>true</enabled>
          </releases>
          <snapshots>
              <enabled>true</enabled>
          </snapshots>
        </repository>
      </repositories>
     <!--插件地址-->
      <pluginRepositories>
         <pluginRepository>
          <id>Deployment</id>
          <url>http://192.168.38.45:8081/repository/maven-public/</url>
          <releases>
           <enabled>true</enabled>
          </releases>
          <snapshots>
          <enabled>true</enabled>
        </snapshots>
       </pluginRepository>
      </pluginRepositories>
    </profile>
  </profiles>
  <!--激活-->
  <activeProfiles>
    <activeProfile>Deployment</activeProfile>
  </activeProfiles>
  
</settings>

13.3 测试上传

(1)pom文件

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.example</groupId>
    <artifactId>rosh-jar</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <properties>
        <java.version>1.8</java.version>
    </properties>
    <distributionManagement>
        <!--release-->
        <repository>
            <id>rosh-releases</id>
            <name>Rosh Release Repository</name>
            <url>http://192.168.38.45:8081/repository/maven-releases/</url>
        </repository>
        <!--快照-->
        <snapshotRepository>
            <id>rosh-snapshots</id>
            <name>Rosh Snapshot Repository</name>
            <url>http://192.168.38.45:8081/repository/maven-snapshots/</url>
        </snapshotRepository>
    </distributionManagement>


</project>

(2)编写测试类

package com.rosh.hello;
public class NexusHello {
    public void  sayHello(){
        System.out.printf("Hello Nexus");
    }
}

(3) 上传

mvn deploy

在这里插入图片描述
在这里插入图片描述

13.4 测试下载

(1)pom

<dependencies>
    <dependency>
        <groupId>org.example</groupId>
        <artifactId>rosh-jar</artifactId>
        <version>1.0-20200823.130007-1</version>
    </dependency>
</dependencies>
<distributionManagement>
    <!--release-->
    <repository>
        <id>rosh-releases</id>
        <name>Rosh Release Repository</name>
        <url>http://192.168.38.45:8081/repository/maven-releases/</url>
    </repository>
    <!--快照-->
    <snapshotRepository>
        <id>rosh-snapshots</id>
        <name>Rosh Snapshot Repository</name>
        <url>http://192.168.38.45:8081/repository/maven-snapshots/</url>
    </snapshotRepository>
</distributionManagement>

(2) 测试类

package com.springboot;

import com.rosh.hello.NexusHello;

public class SpringBootWebTest {
    public static void main(String[] args) {
        NexusHello nexusHello=new NexusHello();
        nexusHello.sayHello();
    }
}

在这里插入图片描述

PS:安装包地址

链接:https://pan.baidu.com/s/1BtA6hkgXp-VYiUDE8rfsYA 
提取码:in9w

http://www.niftyadmin.cn/n/4556745.html

相关文章

以前我没学过编程 请问编程从那里学起

fromuid29811 ||| C语言 ||| 认为自己逻辑性和数学啊什么的不好的 .net 在学习C# 而后学习SQL数据库 这没错 应该先学C 不要一下学多种语言就行 ||| 我个人认为 那些上机就很快啦 编程&#xff1d;数据结构&#xff0b;算法这是真理 真正的高手是不在乎手里拿的是什么武器的 JA…

微信小程序二维码识别

目前市场上二维码识别的软件或者网站越来越多&#xff0c;可是真正方便&#xff0c;无广告的却少之很少。 于是&#xff0c;自己突发奇想做了一个微信二维码识别的小程序。 包含功能&#xff1a; 1、识别二维码 ①普通二维码 ②条形码 ③只是复制解析出来的数据 2、生成二维码 …

【论文阅读】Dynamic Graph CNN for Learning on Point Clouds

论文题目: Dynamic Graph CNN for Learning on Point Clouds (用于点云学习的动态图卷积神经网络) 论文作者: YUE WANG, 麻省理工学院; YONGBIN SUN, 麻省理工学院; ZIWEI LIU, 加州大学伯克利分校/ICSI; SANJAY E. SARMA, 麻省理工学院; MICHAEL M. BRONSTEIN, 伦敦帝国理工…

Sonarqube安装及基本使用

1 需要环境 2 解压包 #解压 unzip sonarqube-6.7.4.zip3 创建数据库 4 修改配置文件 cd /usr/local/sonarqube-6.7.4/conf vim sonar.propertiessonar.jdbc.usernameroot sonar.jdbc.password123456 sonar.jdbc.urljdbc:mysql://192.168.38.45:3306/sonar?useUnicodetrue&am…

Redis + keepalived 高可用行配置检测脚本

Redis 在生产配置中&#xff1b;除redis集群、哨兵模式之外&#xff1b;主从模式还是比较普遍的。 配置 redis 多主从&#xff1b;由 keepalived 做 VIP 地址漂移。可以实现redis的高可用性。 keepalived 配置示例&#xff1b;&#xff08;master 主节点配置&#xff0c;backup…

.net里的timer

}} ElapsedEventArgs e) { Console.WriteLine("The Elapsed event was raised at {0}" using System;using System.Timers;//在这个空间下面public class Timer1{ private static System.Timers.Timer aTimer; public static void Main() { aTimer new System.Timer…

jenkins环境搭建(一)

1 安装 rpm -ivh jenkins-2.190.3-1.1.noarch.rpm2 修改配置 vim /etc/sysconfig/jenkins#用户 JENKINS_USER"root" #端口 JENKINS_PORT"8000"3 启动jenkins systemctl start jenkins #启动失败&#xff0c;查看日志 journalctl -xe #建立软连接 ln -s …

Maven 梳理 - maven新建web项目提示javax.servlet.http.HttpServlet was not found on the Java Build Path...

方法一&#xff1a; <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> 方法二&#xff1a; Java Bui…