linux 上安装,配置Nexus

Nexus入门

安装与启动

  1. 下载

    方式一:在liunx上直接下载

    wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.11.2-03-bundle.tar.gz
    

    方式二:下载完上传到Linux服务器

    官网下载地址: https://www.sonatype.com/download-nexus-repo-oss),官网太慢的话,用下面的地址下载

    百度云地址: https://pan.baidu.com/s/1r65yjGMibvKkIgstiT5K4g 提取码: bk8i

  2. 安装

    (liunx上直接下载忽略上传步骤)

    上传nexus.tar.gz到Linux服务器(也可以用fttp工具上传)

    scp  nexus-2.11.2-03-bundle.tar.gz  root@linux ip:/usr/local/
    

    创建安装目录

    mkdir  /usr/local/nexus
    

    解压

     tar -zxvf nexus-2.11.2-03-bundle.tar.gz -C /usr/local/nexus
    

    配置(端口冲突时配置端口)

    vim /usr/local/nexus/nexus-2.11.2-03/conf/nexus.properties 
    

在这里插入图片描述

设置root启动(后续可更改成特定用户)

vim /usr/local/nexus/nexus-2.11.2-03/bin/nexus

将RUN_AS_USER设置成root

在这里插入图片描述

开放Nexus端口

 firewall-cmd --zone=public --add-port=8081/tcp --permanent

重启防火墙

firewall-cmd --reload
  1. 启动

    #启动
    /usr/local/nexus/nexus-2.11.2-03/bin/nexus start	
    

在这里插入图片描述

​ 其他命令

#查看状态
/usr/local/nexus/nexus-2.11.2-03/bin/nexus status
#重启
/usr/local/nexus/nexus-2.11.2-03/bin/nexus reload

上传与配置

​ nexus访问地址默认为 宿主IP/配置端口(默认8081)/nexus/
在这里插入图片描述

​ 右上角登陆,默认管理员账号

​ 用户名: admin 密码: admin123

​ 将Respository下Type为proxy的仓库配置如下设置,将Download Remote Indexes 设置成ture 点击保存。

在这里插入图片描述

通过Add按钮可以添加3种类型的Repository和Repository Group

Repository Group 就是Repository的集合组

​ Ordered Group Repositories代表这个集合组内含有的仓库 (访问顺序从上到下)

​ Available Repositories 代表可以添加的仓库

​ 可以通过中间的按钮进行增加和删除两个仓库

在这里插入图片描述

上方的add按钮可以添加仓库和仓库组

上传jar包

在这里插入图片描述

maven配置

修改settings.xml中的profile 标签下添加如下配置

        <profile>
            <id>mynexus</id>
            <repositories>
                <repository> 
                    <id>nexus</id>
                  	 <!--此地址nexus配置仓库的Repository Path -->
                    <url>http://192.168.2.188:8081/nexus/content/groups/public/</url> 
                    <releases>
                        <enabled>true</enabled>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                    </snapshots>
                </repository>
            </repositories>
            <pluginRepositories> 
                <pluginRepository> 
                    <id>public</id>
                    <name>Public Repositories</name>
                    <!--此地址nexus配置仓库的Repository Path -->
                    <url>http://192.168.2.188:8081/nexus/content/groups/public/</url>
                </pluginRepository>
            </pluginRepositories>
        </profile>
        

并指定profile

 <activeProfiles>
        <activeProfile>mynexus</activeProfile>
  </activeProfiles>

IDEA中测试能否下载上传Jar包

maven项目中添加坐标,可以看到nexus上传的文件已经下载到本地

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值