一、参见官方给出的文档:
https://help.sonatype.com/repomanager3/upgrade-compatibility---repository-manager-2-to-3
也就是说需要先升级到nexu2的最新版本,再升级到3的最新版本。
二、参见2升级到最新版的文档
https://help.sonatype.com/repomanager3/upgrading#Upgrading-Upgradingfrom2.xto2.y
下载2的最新版本,下载地址如下
https://help.sonatype.com/repomanager2/download#Download-NexusRepositoryManager2OSS
官网文档给出的升级步骤分为:
- Extracting the new release bundle 解压下载的2的最新版
- Replicating configuration changes 复制配置文件
- Stopping 2.x instance 停止之前的2版本的进程
- Replacing the application directory with the new instance 用新的版本作为新的应用程序,即和sonatype-work要在同一目录
- Starting the new instance 启动新的进程
简单来说
1.解压新的nexus,新的nexu目录必须和sonatype-work在同一层级
tar -xvf nexus-2.14.15-01-bundle.tar.gz
2.如果之前的nexus配置文件,即conf下的配置文件做过修改,那么需要覆盖到新的nexus
3.正常启动新的nexus即可
三、升级到3
3的最新版的下载地址
https://www.sonatype.com/nexus-repository-oss
官网升级文档
https://help.sonatype.com/repomanager3/upgrading/upgrade-procedures
具体来看,有如下步骤
1.设置2的nexus的升级功能
- Click to expand Administration in the left-hand panel. 点击打开左侧的Administration菜单
- Click the Capabilities menu item to open the respective screen. 点击Capabilities菜单
- Click the New button to access the Create new capability modal. 点击new按钮新建功能模块
- Select Upgrade: Agent as your capability Type. 新的功能模块的类型选择Upgrade: Agent,如下图:
- Click Add to close the modal and add the capability. 点击Add结束
- Copy and save the Access Token found on the Status tab for your new capability. You need it to configure the Upgrade tool in
version 3. 将token复制下来,在3版本中会使用到
2.安装3的nexus,与2不能在同一目录,也不能使用相同的端口
2.1解压
tar -xvf nexus-3.20.0-04-unix.tar.gz
2.2修改端口
修改nexus-3.20.0-04/etc/nexus-default.properties文件,修改为8082
2.3直接启动,如果碰到错误Detected execution as "root" user. This is NOT recommended!,执行export RUN_AS_USER=root即可
/usr/maven/nexus3/nexus-3.20.0-04/bin/nexus start
3.开始迁移,配置3的升级能力
用admin登录,密码在sonatype-work/nexus3/admin.password文件内,随后根据提示修改密码。
- Click Capabilities in the System section of the Administration main menu to open the Capabilities feature view. 用admin账号登录,并且打开System下的 Capabilities 菜单
- Click Create capability.
- Select Upgrade, then click Create capability to enable the upgrade capability. 也创建一个 Upgrade
- 随后,可以看到多出来的upgrade菜单,如下图
- 输入2的地址以及token
- 选择内容,不需要修改
- 选择仓库传递的三种方式,建议如果是同一台服务器选择copy,比较好
- 随后选择需要迁移的repository仓库,耐心等待结束即可