程序员潇然 发表于 2022-6-30 14:58:10

[maven]如何安装maven私服安装sonatype nexus私服安装环境搭建

maven私服安装,对于很多公司来说有各种各样必须的理由安装maven私服,原因不咋赘述,本文介绍如何搭建公司内的私服环境。
安装环境为windows。

### 下载

网址:```https://www.sonatype.com/```
我当前使用的版本地址:
```https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.38.0-01-win64.zip```

注意:
现在官网下载比较费劲,可以挂代理,或者百度搜,下不动的时候,有时候可以用迅雷,会有速度。

下载后文件如下;
!(data/attachment/forum/202206/30/145023gp3x61vv4tvtxxt2.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 端口号配置(可选)

!(data/attachment/forum/202206/30/145047xpcddoori9zihzwh.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 安装为系统服务

!(data/attachment/forum/202206/30/145117hgs39aa88uvz888p.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
进入安装目录的bin目录下,通过命令:

```nexus.exe /install nexus3```
安装为名为nexus3的Windows服务

!(data/attachment/forum/202206/30/145155nxkdxgttebfe3eqe.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 检查确认服务

可以通过控制面板找到服务,或者win+R,输入services.msc打开
如果是自己的开发机器研究,可以设置为手动启动
初始安装后还未启动,可以直接右键   启动
!(data/attachment/forum/202206/30/145248xbrhuxjuwb5rxrhw.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 启动

稍等几秒钟之后,根据Ip以及端口号进行访问
!(data/attachment/forum/202206/30/145318wkek5eefnm0016fn.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

!(data/attachment/forum/202206/30/145332fs1iykcpg8ijtlby.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 登录

右上角login

根据提示找到初始化密码,然后进行登录即可
!(data/attachment/forum/202206/30/145351pl5xepy4bqq14jz5.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

成功登录后有一些自动弹出的tips ,可以简单看下
!(data/attachment/forum/202206/30/145452npr6rcr6p692c2pc.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

其中有一个是否允许匿名访问,自行按需选择
!(data/attachment/forum/202206/30/145527uv5gen9j4j2nne94.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
!(data/attachment/forum/202206/30/145533fe5zetwt6owtwd2h.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 镜像配置

进入界面之后,点击右侧repositories
!(data/attachment/forum/202206/30/145555katr8gma22d5mvy3.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
添加阿里云镜像
!(data/attachment/forum/202206/30/145606iac5i385cqeq8ncv.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
选择类型
!(data/attachment/forum/202206/30/145616su3lpqzmm04k0exm.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")
!(data/attachment/forum/202206/30/145625xhh7ehj51016jtv7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

### 组调整

!(data/attachment/forum/202206/30/145639r4927jn227cvos9s.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

!(data/attachment/forum/202206/30/145705e1attw6fccjcg8iu.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

查看信息
!(data/attachment/forum/202206/30/145716s2r5x4y5xxe9by47.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "image.png")

自己本机的maven 中的setting.xml文件中的配置如下

```xml
<!-- 私服地址 -->
<mirror>
      <!--This is used to direct the public snapshots repo in the profile below over to a different nexus group -->
      <id>maven-address</id>
      <mirrorOf>*</mirrorOf>
      <!-- 此处配置你的Nexus地址 -->
      <url>http://192.168.1.128:9081/repository/maven-public/</url>
</mirror>
```

!(data/attachment/forum/202206/16/141330jha7st9soow8772i.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/300 "common_log.png")
`转载务必注明出处:程序员潇然,疯狂的字节X,https://www.crazybytex.com/thread-30-1-1.html `

页: [1]
查看完整版本: [maven]如何安装maven私服安装sonatype nexus私服安装环境搭建