neuxs安装和启动
nexus 搭建镜像仓库
1. nexus安装
1.1 下载java jre
最新版本链接
https://www.oracle.com/es/java/technologies/javase/javase8u211-later-archive-downloads.html
国内下载链接:
curl -fL "https://pixiupkg-generic.pkg.coding.net/pixiu/k8stoolsdefault/jre-8u351-linux-x64.tar.gz?version=latest" -o jre-8u351-linux-x64.tar.gz
1.2 nexus下载
官方下载链接
https://download.sonatype.com/nexus/3/nexus-3.45.0-01-unix.tar.gz
国内下载链接
curl -fL "https://pixiupkg-generic.pkg.coding.net/pixiu/k8stoolsdefault/nexus-3.45.0-01-unix.tar.gz?version=latest" -o nexus-3.45.0-01-unix.tar.gz
1.3 nexus脚本整合操作
物料包我统一下载至 /root 目录,放在其他目录也可
cd /root
curl -fL "https://pixiupkg-generic.pkg.coding.net/pixiu/k8stoolsdefault/jre-8u351-linux-x64.tar.gz?version=latest" -o jre-8u351-linux-x64.tar.gz
curl -fL "https://pixiupkg-generic.pkg.coding.net/pixiu/k8stoolsdefault/nexus-3.45.0-01-unix.tar.gz?version=latest" -o nexus-3.45.0-01-unix.tar.gz
tar zxvf jre-8u351-linux-x64.tar.gz
tar zxvf nexus-3.45.0-01-unix.tar.gz
mkdir -p nexus_local
mv -f jre1.8.0_351 nexus-3.45.0-01 sonatype-work nexus_local
# 下载启动脚本
curl -fL "https://pixiupkg-generic.pkg.coding.net/pixiu/k8stoolsdefault/nexus.sh?version=latest" -o ./nexus_local/nexus.sh
# 修改启动端口
cd /root/nexus_local/nexus-3.45.0-01/etc
vi nexus-default.properties
application-port=8081 改为58000
2. nexus启动
cd /root/nexus_local/
sh nexus.sh start
3. 登录 nexus
访问: http://192.168.77.5:58000/ 访问,192.168.77.5 根据你ip地址进行更换
4. 创建nexus repository
4.1 创建 k8simage repository
- Docker Bearer Token Realm 设置为 Active
4.2 配置docker insecure-registries
cat >> /etc/docker/daemon.json <<\EOF
{
"insecure-registries":["192.168.77.5:58001"]
}
EOF
systemctl restart docker
4.3 登录nexus 镜像仓库
docker login 192.168.77.5:58001
- 密码就是之前页面设置的,我设置的用户是 admin, 密码是 admin123
4.4 nexus push和匿名pull下载
docker pull busybox
docker image ls