安装
目前使用window 版本的安装
官方下载地址
https://www.sonatype.com/download-nexus-repo-oss
https://pan.baidu.com/s/1pGJWAIhQ-maFTrjnZe9lyg 3527
官方安装文档:https://help.sonatype.com/repomanager3/installation/installation-methods
1.解压进入安装目录
cd D:\develop\base\nexus\nexus-3.28.0-01\bin
2.运行
./nexus.exe /run
3.访问
http://localhost:8081/ ,一般默认密码为admin/admin123
4.登录修改密码
将nexus配置为系统服务
1.安装jdk
略
2.安装服务
./nexus.exe /install nexus
3.启动服务
./nexus.exe /start
关闭服务
./nexus.exe /stop
配置nexus
1.指定的文件存储目录
1.创建 Blob Strores
setting → Blob Strores → create Blob Strore →
name : NexusDerect ,path:D:\develop\base\nexus\sonatype-work\nexus3\blobs\default
→create Blob Strore
使用默认的就好了
2.创建 Proxy Repository 代理仓库
setting → Repository → create Repository →maven2(proxy)
name: aliyun
remote storage: http://maven.aliyun.com/nexus/content/groups/public/
Blob Strore: default
3.创建host组
setting → Repository → create Repository →maven2(host)
4.创建group组
setting → Repository → create Repository →maven2(group)
注意添加group顺序 先host后aliyun
让 Maven 项目使用 Nexus 私服
<!--nexus服务器-->
<servers>
<server>
<id>nexus-releases</id>
<username>linzx</username>
<password>123456</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>linzx</username>
<password>123456</password>
</server>
</servers>
<!--仓库组的url地址 id和name自定义,mirrorOf的值设置为central,写死的-->
<mirrors>
<mirror>
<id>nexus</id>
<name>nexus repository</name>
<url>http://localhost:8081/repository/my_group/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<repositories>
<repository>
<id>nexus</id>
<url>http://localhost:8081/repository/maven-public/</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
部署上传Jar:配置distributionManagement
1.配置maven里面的setting.xml文件 如上
2.项目中添加如下
pom.xml
<project>
...
<distributionManagement>
<repository>
<id>nexus-releases</id>
<name>Nexus Release Repository</name>
<url>http://localhost:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
...
</project>
搭建yum镜像源
1.添加host
yum_host
2.添加proxy
cenos7:http://mirrors.163.com/centos/7/updates/x86_64/
3.添加group
相应的host和proxy
4.修改yum的respos文件
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://192.168.3.6:8081/repository/group_yum/$releasever/os/$basearch/
gpgcheck=0
#gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
全部注释掉#mirrorlist=
搭建docker私服
1.创建docker blob store
2.创建仓库
host:名字 http:定义端口 允许docker registry api 选择blob 允许上传覆盖(redeloy)创建
获取docker ali镜像 https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
proxy:添加一个阿里url确认
group: 天定义端口:如8082,天机本地和proxy
3.虚拟机操作
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://92yy0xca.mirror.aliyuncs.com"],
"insecure-registries": ["192.168.3.6:8082", "192.168.3.6:8083", "192.168.3.6:8084"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo systemctl daemon-reload
sudo systemctl restart docker
4.测试