1、下载nexus:
https://help.sonatype.com/repomanager2/download
2、上传到linux服务器scp 命令 (以私服IP是10.25.1.14为例 将这个IP改成自己的IP 下同)
#scp nexus-2.15.1-02-bundle.tar.gz root@10.25.1.14:/usr/local/
如果有密码,输入密码即可上传
3、到linux服务器上,解压相应的文件到服务器的/usr/local文件夹下
#tar -zxvf nexus-2.15.1-02-bundle.tar.gz -C ./usr/local
4、启动
[root@localhost bin]# ./nexus start
关闭防火墙
#systemctl stop firewalld.service
5、私服启动不了 按照提示增加配置
[root@localhost local]# cd nexus-2.15.1-02/bin/
[root@localhost bin]# ll
总用量 20
drwxr-xr-x. 15 1001 1001 272 3月 24 2022 jsw
-rwxr-xr-x. 1 1001 1001 14602 3月 24 2022 nexus
-rwxr-xr-x. 1 1001 1001 2339 3月 24 2022 nexus.bat
[root@localhost bin]# ./nexus start
****************************************
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.
修改liunx的配置
在/etc/profile 文件中增加配置:
export RUN_AS_USER=root
[root@localhost bin]# source /etc/profile
6、本机访问私服
7、登录私服 默认用户名:admin 默认密码:admin123 登录进去之后可以修改密码
8、增加阿里云镜像
注意地址不要写错(https://maven.aliyun.com/repository/public)
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
9、点击Public Repositories ->Configuration
将新增加的阿里云移动到左侧
修改下图中的前后位置
10、增加配置文件
在settings.xml <servers>标签后加入如下两个server
<server>
<id>releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
增加mirror
<mirror>
<id>nexus</id>
<mirrorOf>central</mirrorOf>
<name>my nexus</name>
<url>http://10.25.1.14:8081/nexus/content/groups/public/</url>
</mirror>
父pom中增加
<distributionManagement>
<repository>
<id>releases</id>
<name>releases Repository</name>
<url>http://10.25.1.14:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>snapshots Repository</name>
<url>http://10.25.1.14:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
本地pom增加
<repositories>
<repository>
<id>public</id>
<name>maven-public</name>
<url>http://10.25.1.14:8081/nexus/content/groups/public/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
done......
如果对你有帮助,欢迎大家点赞收藏,谢谢!