Nexus 安装部署

Nexus 安装部署

#nexus
unix
windows

依赖

  • jdk8
  • 上传安装包到服务器(使用工具ftp|ssh)
  • 解压安装包
tar -zxvf nexus-3.31.1-01-unix.tar.gz -C 指定路径

目录结构

  • nexus-3.31.1-01:功能实现
  • sonatype-work:存储数据
  • 修改端口
# 配置文件路径 /nexus-3.31.1-01/etc/nexus-default.properties
# 66上端口 8089
  • 基本命令
./nexus-3.31.1-01/bin/nexus start # 后台启动
./nexus-3.31.1-01/bin/nexus run # 前台启动
./nexus-3.31.1-01/bin/nexus stop # 停止
./nexus-3.31.1-01/bin/nexus restart # 重启
./nexus-3.31.1-01/bin/nexus status # 查看服务状态
# Ubuntu
ufw allow tcp/端口号
ufw enable
  • 访问服务
 netstat -tunlp | grep 端口号 # 查看服务状态

浏览器输入服务器地址加nexus监听端口
输入用户名密码(根据提示到服务器指定路径)
修改密码

本地 maven 迁移至 Nexus

上传脚本

脚本放在本地仓库根目录下

#!/bin/bash
# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params

while getopts ":r:u:p:" opt; do
    case $opt in
        r) REPO_URL="$OPTARG"
        ;;
        u) USERNAME="$OPTARG"
        ;;
        p) PASSWORD="$OPTARG"
        ;;
    esac
done

find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

执行脚本

./mavenimport.sh -u admin -p 123456 -r http://192.168.0.66:8089/repository/xunyi/
  • 10
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值