CentOS 搭建 nexus 私服

1. 安装JDK.

安装教程:JDK安装

2. 推荐新建nexus用户管理nexus。

adduser nexus
passwd nexus
su - nexus

3. 下载nexus。本文nexus版本:2.14.8-01 下载地址

或者直接下载 wget https://sonatype-download.global.ssl.fastly.net/nexus/oss/nexus-2.14.1-01-bundle.tar.gz

4. 解压文件:tar -zxvf nexus文件

第一个文件夹是核心文件,第二个文件夹用来存储下载下来的jar。

5. 进入nexus/nexus-2.14.8-01/conf目录下,编辑nexus.properties文件,命令:vim nexus.properties

6. 进入nexus/nexus-2.14.8-01/bin目录,vim nexus,修改启动用户。

7. 启动nexus ./nexus start

8. 访问nexus 地址:端口/nexus

搭建完成。

9. maven settings.xml文件修改。

1
<!--一、localRepository-->
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!--二、mirrors下新建mirror地址-->
<mirror>
<id>internal-repository</id>
<name>Maven Repository Manager running on www.ctfo.com</name>
<url>http://你的私服地址/nexus/content/groups/public/</url>
<mirrorOf>*</mirrorOf>
</mirror>


<!--三、maven项目 deploey jar文件。(IDE)-->
<!--在maven settings.xml文件,新增server配置。-->
<server>
<id>thirdparty</id>
<username>admin</username>
<password>admin123</password>
</server>
<!--在项目pom文件加-->
<distributionManagement>
<repository>
<id>thirdparty</id>
<name>nexus</name>
<url>http://你的私服地址/nexus/content/repositories/thirdparty/</url>
</repository>
</distributionManagement>
<!--然后deploey就到了第三方库。-->