Windows 10上启动安装 私服Nexus Repository,报错及解决全流程记录。

首先要了解Nexus Repository是什么?

> Nexus Repository 是由 Sonatype 开发的开源软件仓库管理器(常作为公司私有包管理服务器(私服),支持Maven等多种平台上传, 下载数据),用于存储、管理和分发各种编程语言的构建工件和二进制文件。

首先要进入Nexus的官网:

https://help.sonatype.com/en/download.html

选择对应版本操作系统进行下载,我这里电脑是windows10:

image

之后解压文件夹:

image

 进入如下目录:

nexus-3.84.0-03-win-x86_64\nexus-3.84.0-03\bin

image

 执行了如下命令,得到报错如下:

D:\kungfu\Java\nexus\nexus-3.84.0-03-win-x86_64\nexus-3.84.0-03\bin>nexus.exe install 
[2025-09-13 17:00:31] [warn] [13280] Failed to grant service user 'NT AUTHORITY\LocalService' write permissions to log path 'C:\Windows\system32\LogFiles\Apache' due to error
'19: 介质受写入保护。' D:\kungfu\Java\nexus\nexus-3.84.0-03-win-x86_64\nexus-3.84.0-03\bin>nexus.exe start
[2025-09-13 17:00:46] [warn] [12768] Can't read service description because registry key 'SYSTEM\CurrentControlSet\Services\nexus' cannot query value at 'Description' (rc=2)
[2025-09-13 17:00:46] [warn] [12768] Failed to obtain service description for
'nexus'
[2025-09-13 17:00:47] [error] [12768] apxServiceControl(): dwState(4 = SERVICE_RUNNING) != dwCurrentState(1 = SERVICE_STOPPED); dwWin32ExitCode = 1066, dwWaitHint = 0 millseconds, dwServiceSpecificExitCode = 1
[2025-09-13 17:00:47] [error] [12768] apxServiceControl(): returning FALSE [2025-09-13 17:00:47] [error] [12768] Failed to start service
'nexus'.
[2025-09-13 17:00:47] [error] [12768] Apache Commons Daemon procrun failed with exit value: 5 (failed to start service). Failed to start service.

报错拆解

  1. 安装服务时报错

Failed to grant service user 'NT AUTHORITY\LocalService' write permissions to log path 'C:\Windows\system32\LogFiles\Apache' due to error '19: 介质受写入保护。'

意思是:Nexus 默认用 LocalService 账号运行,但它没有 C:\Windows\system32\LogFiles\Apache 目录的写权限。这个目录本来是系统日志目录,一般不应该写。

  1. 启动服务时报错

dwWin32ExitCode = 1066, dwServiceSpecificExitCode = 1 Apache Commons Daemon procrun failed with exit value: 5 (failed to start service).

Exit code 1066 表示“服务专用错误”,Nexus 启动失败,原因通常是 配置或权限不对,或者 Java 环境有问题。

 

这里后面发现并不是权限问题,尝试了多种方式,最后发现是由于我电脑之前安装其他软件可能有连带着安装过Nexus,导致有残余文件,所以影响这次重新安装。

所以我先是将如下如下路径的注册表nexus文件给删除了

进入注册表:Win + R, 然后输入regedit

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nexus

 

删除掉了nexus注册表后,执行了如下命令还是报错:

image

这里容易混淆一下:

  • 注册表里的 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\nexus 只是 Windows 服务的配置项,你删除了以后,sc delete nexus 也确实把服务条目清掉了。

  • 但是当我重新执行 nexus.exe install 的时候,它又重新创建了一个 nexus 服务,默认账号还是 LocalService

所以现在 注册表里有新的 nexus 服务项,只是登录账号还是 LocalService → 导致你看到警告(权限不足)。

👉 换句话说:删除注册表只是清理旧的 nexus 服务,你重新 install 后又有了一个新的 nexus 服务,它还需要手工改账号,否则还是跑不起来。

 

接下来进入之前的bin目录,然后分别执行如下命令,

最后看到服务正在启动、服务已经启动成功后,就表明已经Nexus服务已成功启动了。

image

 然后在浏览器输入默认的如下地址:localhost:8081

image

 至此,我们就成功在Windows10上,启动了私服Nexus Repository了。

 

posted @ 2025-09-13 23:05  AlphaGeek  阅读(470)  评论(0)    收藏  举报