1、https://www.sonatype.com/download-oss-sonatype下载2.14 tar.gz文件(3.0需要JDK8以上)
2、上传安装包到linux目录下
3、解压tar zxvf nexus-2.14.1-01-bundle.tar.gz
4、进入bin目录下,输入./nexus start(root用户会出现以下问题,设置步骤参考步骤5)
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
5、进入/etc/profile修改环境变量export RUN_AS_USER=root
6、source profile使设置生效
7、进入nexus的bin目录,./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.
8、http://服务器IP:8081/nexus/(默认端口是8081)修改端口号:进入conf目录,修改nexus.properties的端口
9、登录,默认用户名admin 密码admin23
10、上传jar包到私服
11、配置仓库信息
<repositories> <repository> <id>public</id> 与nexus的仓库名对应(可通过nexus仓库列表,查看configuration配置找到ID) <name>Public Repositories</name> <url>http://IP:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>public</id> <name>Public Repositories</name> <url>http://IP:8081/nexus/content/groups/public/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories>
<!-- 自动打包 通过jenkins上传-->
<distributionManagement>
<repository>
<id>releases</id><!--这个ID需要与你的release仓库的Repository ID一致-->
<url>http://xxx.xx.xx.xx:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>snapshots</id><!--这个ID需要与你的snapshots仓库的Repository ID一致-->
<url>http://xxx.xx.xx.xx:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
12、设置deploy账户密码
security-users-右键deployment
13、部署maven:
将linux安装包上传到文件夹
tat -zvxf 安装文件名
配置conf目录下的setting.xml文件:
在<settings><profiles></profiles></settings>节点之间添加配置:
接着在<settings></settings>节点之间添加配置:
<server>
<id>public</id>与仓库地址ID一致
<username>deployment</username>
<password>123456</password><!--这个密码就是你设置的密码-->
</server>
<id>releases</id>
<username>deployment</username>
<password>123456</password><!--这个密码就是你设置的密码-->
</server>
<server>
<id>snapshots</id>
<username>deployment</username>
<password>123456</password><!--这个密码就是你设置的密码-->
</server>
以上配置好了连接Nexus私服。
14、运行发布控制台mvn clean deploy