搭建Nexus Repository包管理系统

下载安装程序

下载Nexus Repository最新版本

配置说明

将下载后的文件传输到服务器上

#修改配置文件
vi /etc/security/limits.conf #添加
* soft nofile 65536 #修改服务配置
vi /etc/systemd/system.conf #修改
DefaultLimitNOFILE=65536 #重启
reboot #查看结果
ulimit -n #将当前目标下的文件上传到目标服务器的指定路径
scp nexus-3.23.0-03-unix.tar root@192.168.0.5:/opt/ #解压
tar -xvf nexus-3.23.0-03-unix.tar #做一个软链接方便访问和更新
ln -s /opt/nexus-3.23.0-03/ /nexus #修改运行用户
vi /nexus/bin/nexus.rc #修改运行用户,除非自己个人使用否则不要用root用户
run_as_user="root" ln -s /nexus/bin/nexus /etc/init.d/nexus #init.d设置
cd /etc/init.d
chkconfig --add nexus
chkconfig --levels 345 nexus on
service nexus start #创建Nexus服务
vi /etc/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target [Service]
Type=forking
LimitNOFILE=65536
ExecStart=/nexus/bin/nexus start
ExecStop=/nexus/bin/nexus stop
User=root
Restart=on-abort
TimeoutSec=600 [Install]
WantedBy=multi-user.target

如果没有安装JAVA,请看:

安装Java1.8

#重新加载服务
systemctl daemon-reload #开机启动
systemctl enable nexus.service #运行服务
systemctl start nexus.service #查看日志
tail -f /opt/sonatype-work/nexus3/log/nexus.log

访问http://192.168.0.5:8081 进入管理界面。

创建YUM仓库

创建YUM代理仓库官方说明

Nexus服务器域名和端口:repo.bluersw.com:8081

Proxy仓库:

Group仓库:

客户端配置:

#备份
cd /etc/yum.repos.d/
mkdir bak
cp *.repo bak/ vi /etc/yum.repos.d/CentOS-Base.repo

修改CentOS-Base文件内容:

[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://repo.bluersw.com:8081/repository/repo-bluersw/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://repo.bluersw.com:8081/repository/repo-bluersw/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://repo.bluersw.com:8081/repository/repo-bluersw/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://repo.bluersw.com:8081/repository/repo-bluersw/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all
yum makecache #更新系统第一次会比较慢
yum update -y

下载的RPM包都存储在Nexus服务器上,以后其他服务器照此配置就不用从外网下载了。

创建Docker仓库

创建Docker仓库官方说明

Proxy仓库:

  • 仓库名称:hub-docker-proxy
  • 仓库类型:proxy
  • 远程仓库地址:https://registry-1.docker.io
  • Repository Connectors:不创建(由Group仓库负责)
  • Allow anonymous docker pull ( Docker Bearer Token Realm required ):true(勾选)
  • Enable Docker V1 API:勾选
  • Docker Index:Use Docker Hub

Hosted仓库:

  • 仓库名称:my-docker-host
  • 仓库类型:hosted
  • Repository Connectors:HTTP 8082端口(负责Push Image)
  • Allow anonymous docker pull ( Docker Bearer Token Realm required ):true(勾选)
  • Enable Docker V1 API:勾选
  • 对外地址:http://repo.bluersw.com:8082

Group仓库:

  • 仓库名称:docker-bluersw(含hub-docker-proxy和my-docker-host)
  • 仓库类型:group
  • Repository Connectors:HTTP 8083端口(负责Pull Image)
    • Allow anonymous docker pull ( Docker Bearer Token Realm required ):true(勾选)
  • 对外地址:http://repo.bluersw.com:8083

group类型的Docker仓库只能pull不能push。

在Security中打开Realms界面,激活Docker Bearer Token Realm 选项。

客户端配置:

vi /etc/docker/daemon.json

修改Docker的daemon配置文件,添加上述两个Docker私服地址。

{
"insecure-registries": ["http://repo.bluersw.com:8082","http://repo.bluersw.com:8083"]
}
#重启服务
systemctl restart docker #登录
docker login http://repo.bluersw.com:8082
docker login http://repo.bluersw.com:8083 #使用代理服务器下载镜像,镜像会存在代理服务器上供其他人下载
docker pull repo.bluersw.com:8083/hello-world [root@ops docker]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
repo.bluersw.com:8083/hello-world latest bf756fb1ae65 4 months ago 13.3kB #改名
docker tag repo.bluersw.com:8083/hello-world repo.bluersw.com:8082/hello-world #上传到Docker私有仓库
docker push repo.bluersw.com:8082/hello-world

www.bluersw.com

搭建Nexus Repository包管理系统的更多相关文章

  1. Maven私服搭建(Nexus Repository Manager 3)

    下载和安装 下载地址:https://help.sonatype.com/repomanager3/download 注意:Nexus Repository Manager 3是一个Java服务器应用 ...

  2. 搭建nexus私服,无法下载相关jar包,报错Repository proxy-mode is BLOCKED_AUTO

    在搭建nexus私服的时候,之前没直接用来下载maven的相关插件jar包,一直可以使用, 结果今天要编译hadoop的时候,在linux上新用maven就报错了,无法下载maven的相关插件(如下) ...

  3. Nexus Repository 搭建及使用

    Nexus Repository 是搭建maven的镜像的工具之一,在全球范围内使用挺广的. 一.Nexus 搭建过程 Nexus 镜像的搭建还是相对简单的,将下载的文件解压到相应的目录下,然后进入. ...

  4. 使用 Nexus Repository Manager 搭建 npm 私服

    目录 环境 下载与安装 添加npm仓库 配置与验证npm仓库 发布自己的包 Nexus开启启动 脚注 环境 windows10(1803) Nexus Repository Manager OSS 3 ...

  5. [转] 使用HTTPS在Nexus Repository Manager 3.0上搭建私有Docker仓库

    FROM: https://www.hifreud.com/2018/06/06/03-nexus-docker-repository-with-ssl/ 搭建方式 搭建SSL的Nexus官方提供两种 ...

  6. Linux 安装配置maven3.0 以及搭建nexus私服

    http://carvin.iteye.com/blog/785365 一.软件准备 1.apache-maven-3.0-bin.tar.gz 下载地址:http://www.apache.org/ ...

  7. centos7搭建nexus maven私服

    前置条件: 1.安装jdk,可参考 http://www.cnblogs.com/grey-wolf/p/6480489.html 2.nexus仓库管理器,分为两个版本,Nexus Reposito ...

  8. linux下安装nexus repository及Intellij Idea集成私有maven

    前段日子公司搞java项目,使用nexus repository搭建了私有maven库,现在把原来的私有nuget也迁到nexus repository上了,下面介绍下搭建流程: https://he ...

  9. window Maven私服搭建——nexus

    注:本文来源于 <window   Maven私服搭建--nexus> Maven私服搭建--nexus 1.下载nexus https://www.sonatype.com/downlo ...

随机推荐

  1. 《C程序设计语言》 练习1-22

    问题描述 练习1-22 编写一个程序,把较长的输入行“折”成短一些的两行或者多行,折行的位置在输入行的第N列之前的最后一个非空格之后.要保持程序能够智能地处理输入行很长以及在制定的列前没有空格或者制表 ...

  2. python操作ansible api示例

    #!/usr/bin/env python # -*- coding:utf-8 -*- import json import shutil from collections import named ...

  3. spring中bean的常用属性

    一.scop scope用来配置bean对象是否是单例模式.单例模式是java的二十三种设置模式之一,指在这个项目运行过程中一 个类的对象只会实例化一次.一般,工厂类的对象都是单例模式.非单例模式叫多 ...

  4. 201771030125-王英雪 实验一 软件工程准备一<构建之法与博客首秀>

    项目 内容 班级博客 点我呀! 作业要求 看这里! 课程学习目标 提出三个问题并以写博客的形式记录下来 参考文献 现代软件工程讲义 三个问题 问题一:软件工程究竟是什么? 在现代软件工程讲义一书中给出 ...

  5. Liunx常用操作(五)-如何查询文档中的冒号与引号

    liunx下面有如下一段包含json格式的文档 一.单查所有冒号: .txt | grep [:] 结果如下: 二.单查所有引号: 这里需要转义 .txt | grep [\"] 三.gre ...

  6. html5 canvas画云

    使用函数画出天空的云层图像: y 主要使用到的是数学的圆与弧度之间转换关系: 代码如下 //div对象 var parentContainer = document.getElementById(&q ...

  7. 2018-06-21 js正则表达式

    正则表达式:描述了一种字符串匹配的模式,可以用来检查一个串是否含有某种子串.将匹配的子串替换或者从某个串中取出符合某个条件的子串等. 1.修饰符 i->忽略大小写: g->全部匹配: m- ...

  8. 初涉WebGL

    之前一直在捣鼓Vue和React栈,对组件化架构项目有了些理解和体会.今天尝尝WebGL,当然,并不打算现在深入,只是略作了解,我知道这个坑很深. js的图形库.3d库也有好几款比较流行的,如游戏开发 ...

  9. Codeforces1157B(B题)Long Number

    B. Long Number You are given a long decimal number aa consisting of nn digits from 11 to 99. You als ...

  10. vs2015 cppunit配置及使用

    目录 第一步 第二步 第三步 编译生成lib库 使用 calculator类测试 代码部分 第一步 下载源代码 http://sourceforge.net/projects/cppunit/file ...