centos maven 私服安装

188 阅读1分钟
  1. 查找镜像
docker search  nexus

image.png 2. 拉取最新版本

docker pull sonatype/nexus3

image.png

  1. 持久化目录
mkdir -p /data/nexus/data
chmod 777 -R /data/nexus/data
  1. 启动镜像
docker run -d --name nexus3 --privileged=true -p 9081:8081 -p 9082:8082 -p 9083:8083 --restart always -v /data/nexus/data:/nexus-data sonatype/nexus3

5.开放端口

firewall-cmd --zone=public --permanent --add-port=9081/tcp 
firewall-cmd --zone=public --permanent --add-port=9082/tcp 
firewall-cmd --zone=public --permanent --add-port=9083/tcp 
#重新启动防火墙 systemctl restart firewalld
  1. 查看日志 Started Sonatype Nexus OSS 表示启动好了
docker logs -f nexus3

image.png

  1. 访问nexus,ip:9081,查看管理员

image.png 7.添加阿里云

  1. 点击settings->Repository->Repositories
  2. 选择maven2 (proxy)
  3. 填写如下两个字段,分别是代理库的名称,所代理的上层库的url。阿里云url为:
http://maven.aliyun.com/nexus/content/groups/public/

image.png 4. 滚动到页面最下方,点击“Create repositoty”按钮。 5. 重新配置maven-public组,使其包含新建的aliyun-maven

image.png 8.配置maven (1)配置settings.xml 设置全局

image.png (2)增加mirrors

image.png