旧的nexus服务器机器配置不行,顺便和Jenkins一起迁移至新的macmini机器上。
下载nexus并解压,官网地址:https://www.sonatype.com/download-oss-sonatype
解压后有两个目录:

nexus
基础命令:
命令行进入本地nexus-3.43.0-01
的bin
目录,然后使用以下命令:
1 | $ ./nexus start 启动 |
启动 nexus
时报错:
1 | No suitable Java Virtual Machine could be found on your system. |
错误原因:当前 nexus
要求使用 JVM
1.8;但是当前系统 jdk
环境配置不是1.8版本;
解决方法:
- 下载
jdk
8并安装;
官方下载地址:https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
- 安装后
jdk
目录为:
1 | /Library/Java/JavaVirtualMachines/jdk1.8.0_251.jdk/Contents/Home |
进入nexus-3.24.0-02
的 bin
目录下,修改其中的 nexus
文件:
1 | $ vim nexus |
取消INSTALL4J_JAVA_HOME_OVERRIDE
的注释,并填入jdk
1.8的环境目录:

保存并退出,重新启动nexus即可:
1 | ./nexus start |

至此,nexus服务已部署完成,需要把原来nexus服务器的仓库迁移过来:
把sonatype-work目录备份:
1 | mv sonatype-work sonatype-work.bak |
把原来服务器上的sonatype-work目录拷贝过来就行:
1 | scp -r /data/src/sonatype-work/ stary@172.22.13.45:/Users/stary/nexus/ |
把nexus服务重启即可:
